The LineColumnReader
is an extension to BufferedReader
that keeps track of the line and column information of where the cursor is.
Constructor and description |
---|
LineColumnReader
(Reader reader) Constructor wrapping a Reader
(FileReader , FileReader , InputStreamReader , etc.) |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
close() Closes the stream and releases any system resources associated with it. |
|
long |
getColumn() |
|
long |
getColumnMark() |
|
long |
getLine() |
|
long |
getLineMark() |
|
void |
mark(int readAheadLimit) Marks the present position in the stream. |
|
int |
read() Reads a single character. |
|
int |
read(char[] chars, int startOffset, int length) Reads characters into a portion of an array. |
|
int |
read(char[] chars) Reads characters into an array. |
|
int |
read(CharBuffer buffer) Not implemented. |
|
String |
readLine() Reads a line of text. |
|
void |
reset() Resets the stream to the most recent mark. |
|
void |
setColumn(long column) |
|
void |
setColumnMark(long columnMark) |
|
void |
setLine(long line) |
|
void |
setLineMark(long lineMark) |
|
long |
skip(long toSkip) Skips characters. |
Methods inherited from class | Name |
---|---|
class BufferedReader |
read, read, close, readLine, mark, markSupported, reset, skip, lines, ready, read, read, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
class Reader |
read, read, read, read, close, mark, markSupported, reset, skip, ready, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor wrapping a Reader
(FileReader
, FileReader
, InputStreamReader
, etc.)
reader
- the reader to wrapCloses 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.
Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point.
readAheadLimit
- 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.Reads a single character.
Reads characters into a portion of an array.
chars
- Destination array of charstartOffset
- Offset at which to start storing characterslength
- Maximum number of characters to readReads 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.
chars
- Destination bufferNot implemented.
buffer
- Destination bufferReads 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.
Resets the stream to the most recent mark.
Skips characters.
toSkip
- the number of characters to skipCopyright © 2003-2018 The Apache Software Foundation. All rights reserved.