public class CountingReader extends FilterReader
FilterReader that counts characters and line breaks in the stream. As usual, a line break is either
a '\r', a '\n', or a sequence "\r\n".offset(),
lineNumber(),
columnNumber()in| Constructor and Description |
|---|
CountingReader(Reader in) |
| Modifier and Type | Method and Description |
|---|---|
int |
columnNumber()
Returns the column number of the previously read character, or '0' if no character has been read
yet.
|
int |
lineNumber()
Returns the line number of the previously read character, or '1' if no character has been read
yet.
|
int |
offset() |
int |
read() |
int |
read(char[] cbuf,
int off,
int len) |
close, mark, markSupported, ready, reset, skippublic CountingReader(Reader in)
public int offset()
public int lineNumber()
If the previously read character is CR or LF, then the result is the number of the line following the line separator.
public int columnNumber()
If the previously read character is CR or LF, then the result is '0'.
public int read()
throws IOException
read in class FilterReaderIOExceptionpublic int read(char[] cbuf,
int off,
int len)
throws IOException
read in class FilterReaderIOExceptionCopyright © 2018 Arno Unkrig. All rights reserved.