public class LineColumnReader extends BufferedReader
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.) |
| Modifier and Type | Method 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)
Reads characters into an array.
|
int |
read(char[] chars,
int startOffset,
int length)
Reads characters into a portion of 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.
|
markSupported, readypublic LineColumnReader(Reader reader)
Reader
(FileReader, FileReader, InputStreamReader, etc.)reader - the reader to wrappublic void mark(int readAheadLimit)
throws IOException
mark in class BufferedReaderreadAheadLimit - 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.IOExceptionpublic void reset()
throws IOException
reset in class BufferedReaderIOExceptionpublic int read()
throws IOException
read in class BufferedReaderIOExceptionpublic int read(char[] chars,
int startOffset,
int length)
throws IOException
read in class BufferedReaderchars - Destination array of charstartOffset - Offset at which to start storing characterslength - Maximum number of characters to readIOExceptionpublic String readLine() throws IOException
readLine in class BufferedReaderIOExceptionpublic long skip(long toSkip)
throws IOException
skip in class BufferedReadertoSkip - the number of characters to skipIOExceptionpublic int read(char[] chars)
throws IOException
read in class Readerchars - Destination bufferIOExceptionpublic int read(CharBuffer buffer)
read in interface Readableread in class Readerbuffer - Destination bufferUnsupportedOperationException - as the method is not implementedpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class BufferedReaderIOExceptionpublic long getColumn()
public void setColumn(long column)
public long getColumnMark()
public void setColumnMark(long columnMark)
public long getLine()
public void setLine(long line)
public long getLineMark()
public void setLineMark(long lineMark)