|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--java.io.FilterInputStream | +--java.io.LineNumberInputStream
An input stream that keeps track of line numbers.
Field Summary |
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
LineNumberInputStream(InputStream in)
Constructs a new LineNumberInputStream initialized with the specified input stream. |
Method Summary | |
int |
available()
Returns the number of bytes that can be read without blocking. |
int |
getLineNumber()
Returns the current line number. |
void |
mark(int readlimit)
Marks the current position in the input stream. |
int |
read()
Reads a byte of data. |
int |
read(byte[] b,
int off,
int len)
Reads into an array of bytes. |
void |
reset()
Repositions the stream to the last marked position. |
void |
setLineNumber(int lineNumber)
Sets the current line number. |
long |
skip(long n)
Skips n bytes of input. |
Methods inherited from class java.io.FilterInputStream |
close, markSupported, read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LineNumberInputStream(InputStream in)
in
- the input streamMethod Detail |
public int read() throws IOException
read
in class FilterInputStream
IOException
- If an I/O error has occurred.public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
IOException
- If an I/O error has occurred.public void setLineNumber(int lineNumber)
lineNumber
- the line number to be setpublic int getLineNumber()
public long skip(long n) throws IOException
skip
in class FilterInputStream
n
- the number of bytes to be skipped
IOException
- If an I/O error has occurred.public int available() throws IOException
available
in class FilterInputStream
IOException
public void mark(int readlimit)
mark
in class FilterInputStream
readlimit
- the maximum limit of bytes allowed to be read
before the mark position becomes invalid.public void reset() throws IOException
reset
in class FilterInputStream
IOException
- If the stream has not been marked or
if the mark has been invalidated.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |