LineColumnReader is an extension to BufferedReader
that keeps track of the line and column information of where the cursor is.
| Modifier and Type | Field and Description |
|---|---|
| private long | column
The current column position |
| private long | columnMark
The latest marked line position |
| private long | line
The current line position |
| private long | lineMark
The latest marked line position |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | LineColumnReader(Reader
the reader to wrap reader)Constructor wrapping a |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. |
| public long | |
| public long | |
| public long | |
| public long | |
| public void | mark(int
Limit on the number of characters that may be read while still preserving the mark.
An attempt to reset the stream after reading characters up to this limit or beyond may fail.
A limit value larger than the size of the input buffer will cause a new buffer to be allocated whose size is no smaller than limit.
Therefore large values should be used with care. readAheadLimit)Overrides java. |
| public int | Returns: The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reachedOverrides java. |
| public int | Returns: an exception if an error occursDestination array of char chars, int Offset at which to start storing characters startOffset, int Maximum number of characters to read length)Overrides java. |
| public int | Returns: The number of characters read, or -1 if the end of the stream has been reachedDestination buffer chars)Overrides java. |
| public int | Returns: The number of characters read, or -1 if the end of the stream has been reachedDestination buffer buffer)Overrides java. Implements java. |
| public String | Returns: A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reachedOverrides java. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public long | Returns: The number of characters actually skippedthe number of characters to skip toSkip)Overrides java. |
| column | back to summary |
|---|---|
| private long column The current column position | |
| columnMark | back to summary |
|---|---|
| private long columnMark The latest marked line position | |
| line | back to summary |
|---|---|
| private long line The current line position | |
| lineMark | back to summary |
|---|---|
| private long lineMark The latest marked line position | |
| newLineWasRead | back to summary |
|---|---|
| private boolean newLineWasRead | |
| LineColumnReader | back to summary |
|---|---|
| public LineColumnReader(Reader reader) Constructor wrapping a
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.
| |
| getColumn | back to summary |
|---|---|
| public long getColumn() | |
| getColumnMark | back to summary |
|---|---|
| public long getColumnMark() | |
| getLine | back to summary |
|---|---|
| public long getLine() | |
| getLineMark | back to summary |
|---|---|
| public long getLineMark() | |
| mark | back to summary |
|---|---|
| public void mark(int readAheadLimit) throws IOException Overrides java. Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Reads a single character.
| |
| read | back to summary |
|---|---|
| public int read(char[] chars, int startOffset, int length) throws IOException Overrides java. Reads characters into a portion of an array.
| |
| read | back to summary |
|---|---|
| public int read(char[] chars) throws IOException Overrides java. Reads characters into an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.
| |
| read | back to summary |
|---|---|
| public int read(CharBuffer buffer) Overrides java. Implements java. Not implemented.
| |
| readLine | back to summary |
|---|---|
| public String readLine() throws IOException Overrides java. Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
| |
| reset | back to summary |
|---|---|
| public void reset() throws IOException Overrides java. Resets the stream to the most recent mark.
| |
| setColumn | back to summary |
|---|---|
| public void setColumn(long column) | |
| setColumnMark | back to summary |
|---|---|
| public void setColumnMark(long columnMark) | |
| setLine | back to summary |
|---|---|
| public void setLine(long line) | |
| setLineMark | back to summary |
|---|---|
| public void setLineMark(long lineMark) | |
| skip | back to summary |
|---|---|
| public long skip(long toSkip) throws IOException Overrides java. Skips characters.
| |