In particular the reader supports a look-ahead option, which allows you to see the next char returned by
read(). This reader also tracks how many characters have been read with getPosition().
| Modifier and Type | Field and Description |
|---|---|
| private long | bytesRead
The number of bytes read so far. |
| private long | |
| private final CharsetEncoder | encoder
Encoder for calculating the number of bytes for each character read. |
| private int | lastChar
The last char returned |
| private int | |
| private long | lineNumber
The count of EOLs (CR/LF/CRLF) seen so far |
| private long | |
| private long | position
The position, which is the number of characters read so far |
| private long |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | ExtendedBufferedReader(final Reader
the reader supports a look-ahead option. reader, final Charset the character set for encoding, or charset, final boolean null if not applicable.true to enable byte tracking; false to disable it.Constructs a new instance with the specified reader, character set, and byte tracking option. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides org. Implements java. Closes the stream. |
| pack-priv long | Returns: the number of bytes read by the readGets the number of bytes read by the reader. |
| private int | Returns: the byte length of the character.the current character to process. current)Gets the byte length of the given character based on the the original Unicode specification, which defined characters as fixed-width 16-bit entities. |
| pack-priv int | Returns: the last character that was readReturns the last character that was read as an integer (0 to 65535). |
| pack-priv long | |
| pack-priv long | Returns: the current position in the reader (counting characters, not bytes since this is a Reader)Gets the character position in the reader. |
| public void | mark(final int
the number of characters that can be read before the mark is invalidated. readAheadLimit)Overrides org. Sets a mark position in this reader. |
| public int | read()
Overrides org. Reads a single character from this reader and returns it with the two higher-order bytes set to 0. |
| public int | read(final char[]
the character array to store the characters read. buf, final int the initial position in offset, final int buffer to store the bytes read from this reader.the maximum number of characters to read, must be non-negative. length)Overrides org. Reads at most |
| public String | Returns: the line that was read, or null if reached EOF.Overrides org. Gets the next line, dropping the line terminator(s). |
| public void | reset()
Overrides org. Resets this reader's position to the last |
| bytesRead | back to summary |
|---|---|
| private long bytesRead The number of bytes read so far. | |
| bytesReadMark | back to summary |
|---|---|
| private long bytesReadMark | |
| encoder | back to summary |
|---|---|
| private final CharsetEncoder encoder Encoder for calculating the number of bytes for each character read. | |
| lastChar | back to summary |
|---|---|
| private int lastChar The last char returned | |
| lastCharMark | back to summary |
|---|---|
| private int lastCharMark | |
| lineNumber | back to summary |
|---|---|
| private long lineNumber The count of EOLs (CR/LF/CRLF) seen so far | |
| lineNumberMark | back to summary |
|---|---|
| private long lineNumberMark | |
| position | back to summary |
|---|---|
| private long position The position, which is the number of characters read so far | |
| positionMark | back to summary |
|---|---|
| private long positionMark | |
| ExtendedBufferedReader | back to summary |
|---|---|
| pack-priv ExtendedBufferedReader(final Reader reader) Constructs a new instance using the default buffer size. | |
| ExtendedBufferedReader | back to summary |
|---|---|
| pack-priv ExtendedBufferedReader(final Reader reader, final Charset charset, final boolean trackBytes) Constructs a new instance with the specified reader, character set, and byte tracking option. Initializes an encoder if byte tracking is enabled and a character set is provided. | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides org. Implements java. Closes the stream.
| |
| getBytesRead | back to summary |
|---|---|
| pack-priv long getBytesRead() Gets the number of bytes read by the reader.
| |
| getEncodedCharLength | back to summary |
|---|---|
| private int getEncodedCharLength(final int current) throws CharacterCodingException Gets the byte length of the given character based on the the original Unicode specification, which defined characters as fixed-width 16-bit entities. The Unicode characters are divided into two main ranges:
| |
| getLastChar | back to summary |
|---|---|
| pack-priv int getLastChar() Returns the last character that was read as an integer (0 to 65535). This will be the last character returned by
any of the read methods. This will not include a character read using the
| |
| getLineNumber | back to summary |
|---|---|
| pack-priv long getLineNumber() Returns the current line number
| |
| getPosition | back to summary |
|---|---|
| pack-priv long getPosition() Gets the character position in the reader.
| |
| mark | back to summary |
|---|---|
| public void mark(final int readAheadLimit) throws IOException Overrides org. Doc from org. Sets a mark position in this reader. The parameter
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides org. Doc from org. Reads a single character from this reader and returns it with the two higher-order bytes set to 0. If possible, BufferedReader returns a character from the buffer. If there are no characters available in the buffer, it fills the buffer and then returns a character. It returns -1 if there are no more characters in the source reader.
| |
| read | back to summary |
|---|---|
| public int read(final char[] buf, final int offset, final int length) throws IOException Overrides org. Doc from org. Reads at most
| |
| readLine | back to summary |
|---|---|
| public String readLine() throws IOException Overrides org. Gets the next line, dropping the line terminator(s). This method should only be called when processing a comment, otherwise, information can be lost.
Increments
Sets
| |
| reset | back to summary |
|---|---|
| public void reset() throws IOException Overrides org. Doc from org. Resets this reader's position to the last
| |