| java.lang.Object | |||
| ↳ | java.io.Reader | ||
| ↳ | java.io.BufferedReader | ||
| ↳ | java.io.LineNumberReader | ||
LineNumberReader is a buffered character input reader which counts line numbers as data is being read. The line number starts at 0 and is incremented any time '\r', '\n', or '\r\n' is read.
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.Reader
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new buffered LineNumberReader on the Reader
in. | |||||||||||
Constructs a new buffered LineNumberReader on the Reader
in. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns a int representing the current line number for this
LineNumberReader.
| |||||||||||
Set a Mark position in this LineNumberReader.
| |||||||||||
Reads at most
count chars from this LineNumberReader and
stores them in char array buffer starting at offset
offset. | |||||||||||
Reads a single char from this LineNumberReader and returns the result as
an int.
| |||||||||||
Returns a
String representing the next line of text
available in this LineNumberReader. | |||||||||||
Reset this LineNumberReader to the last marked location.
| |||||||||||
Sets the lineNumber of this LineNumberReader to the specified
lineNumber. | |||||||||||
Skips
count number of chars in this LineNumberReader. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.io.BufferedReader
| |||||||||||
From class java.io.Reader
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.io.Closeable
| |||||||||||
From interface java.lang.Readable
| |||||||||||
Constructs a new buffered LineNumberReader on the Reader in.
The default buffer size (8K) is allocated and all reads can now be
filtered through this LineNumberReader.
| in | the Reader to buffer reads on. |
|---|
Constructs a new buffered LineNumberReader on the Reader in.
The buffer size is specified by the parameter size and all
reads can now be filtered through this LineNumberReader.
| in | the Reader to buffer reads on. |
|---|---|
| size | the size of buffer to allocate. |
Returns a int representing the current line number for this LineNumberReader.
Set a Mark position in this LineNumberReader. The parameter
readLimit indicates how many characters can be read before
a mark is invalidated. Sending reset() will reposition the reader back to
the marked position provided readLimit has not been
surpassed. The lineNumber associated with this marked position will also
be saved and restored when reset() is sent provided
readLimit has not been surpassed.
| readlimit | an int representing how many characters must be read before invalidating the mark. |
|---|
| IOException | If an error occurs attempting mark this LineNumberReader. |
|---|
Reads at most count chars from this LineNumberReader and
stores them in char array buffer starting at offset
offset. Answer the number of chars actually read or -1 if
no chars were read and end of reader was encountered. This implementation
reads chars from the target stream. The line number count is incremented
if a line terminator is encountered. A line delimiter sequence is
determined by '\r', '\n', or '\r\n'. In this method, the sequence is
always translated into '\n'.
| buffer | the char array in which to store the read chars. |
|---|---|
| offset | the offset in buffer to store the read chars. |
| count | the maximum number of chars to store in buffer. |
| IOException | If the reader is already closed or another IOException occurs. |
|---|
Reads a single char from this LineNumberReader and returns the result as an int. The low-order 2 bytes are returned or -1 of the end of reader was encountered. This implementation returns a char from the target reader. The line number count is incremented if a line terminator is encountered. A line delimiter sequence is determined by '\r', '\n', or '\r\n'. In this method, the sequence is always translated into '\n'.
| IOException | If the reader is already closed or another IOException occurs. |
|---|
Returns a String representing the next line of text
available in this LineNumberReader. A line is represented by 0 or more
characters followed by '\n', '\r',
"\n\r" or end of stream. The String does
not include the newline sequence.
| IOException | If the LineNumberReader is already closed or some other IO error occurs. |
|---|
Reset this LineNumberReader to the last marked location. If the
readlimit has been passed or no mark has
been set, throw IOException. This implementation resets the target
reader. It also resets the line count to what is was when this reader was
marked.
| IOException | If the reader is already closed or another IOException occurs. |
|---|
Sets the lineNumber of this LineNumberReader to the specified
lineNumber. Note that this may have side effects on the
line number associated with the last marked position.
| lineNumber | the new lineNumber value. |
|---|
Skips count number of chars in this LineNumberReader.
Subsequent read()'s will not return these chars unless
reset() is used. This implementation skips
count number of chars in the target stream and increments
the lineNumber count as chars are skipped.
| count | the number of chars to skip. |
|---|
| IOException | If the reader is already closed or another IOException occurs. |
|---|