public class CountingReader
extends java.io.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()| Constructor and Description |
|---|
CountingReader(java.io.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) |
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 java.io.IOException
read in class java.io.FilterReaderjava.io.IOExceptionpublic int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterReaderjava.io.IOException