public class LineNumberIndexReader
extends java.io.FilterReader
| Modifier and Type | Field and Description |
|---|---|
static char[] |
LINEBREAKCHARS
Holds the characters '\n','\r','
','
' and '
' .
|
| Constructor and Description |
|---|
LineNumberIndexReader(java.io.Reader reader) |
| Modifier and Type | Method and Description |
|---|---|
int |
getIndex()
Returns the index of the last character read, or -1 if nothing has been read so far
|
int |
getIndexOfEndOfLine(int line)
Returns the character index of the last character on the specified line.
|
int |
getIndexOfLine(int line)
Returns the character index of the first character on the specified line.
|
int |
getLine()
Returns the current line number.
|
int |
getLine(int index)
Returns the line number of the specified character position
if that position has already been read.
|
static boolean |
isLineBreakChar(int c)
Returns true if the specified character is one of
'\n','\r','
','
' or '
'.
|
int |
read() |
int |
read(char[] cbuf,
int off,
int len) |
public static final char[] LINEBREAKCHARS
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.IOExceptionpublic int getLine(int index)
index - character position (zero based)java.lang.IndexOutOfBoundsException - if index exceeds the number of characters readpublic int getLine()
public int getIndex()
public int getIndexOfLine(int line)
line - line number starting with 1java.lang.IndexOutOfBoundsException - if line parameter is smaller 1 or greater than number of linespublic int getIndexOfEndOfLine(int line)
line - line number starting with 1java.lang.IndexOutOfBoundsException - if line parameter is smaller 1 or greater than number of linespublic static boolean isLineBreakChar(int c)
c - to be tested