| java.lang.Object | |||
| ↳ | java.io.InputStream | ||
| ↳ | java.io.FilterInputStream | ||
| ↳ | java.io.LineNumberInputStream | ||
This class is deprecated.Use LineNumberReader
LineNumberInputStream is a filter class which counts the number of line
terminators from the data read from the target InputStream. A line delimiter
sequence is determined by '\r', '\n', or '\r\n'. When using read,
the sequence is always translated into '\n'.
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.FilterInputStream
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new LineNumberInputStream on the InputStream
in. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns a int representing the number of bytes that are available before
this LineNumberInputStream will block.
| |||||||||||
Returns a int representing the current line number for this
LineNumberInputStream.
| |||||||||||
Set a Mark position in this LineNumberInputStream.
| |||||||||||
Reads at most
length bytes from this LineNumberInputStream
and stores them in byte array buffer starting at
offset. | |||||||||||
Reads a single byte from this LineNumberInputStream and returns the
result as an int.
| |||||||||||
Reset this LineNumberInputStream to the last marked location.
| |||||||||||
Sets the lineNumber of this LineNumberInputStream to the specified
lineNumber. | |||||||||||
Skips
count number of bytes in this InputStream. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.io.FilterInputStream
| |||||||||||
From class java.io.InputStream
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.io.Closeable
| |||||||||||
Constructs a new LineNumberInputStream on the InputStream in.
All reads are now filtered through this stream and line numbers will be
counted for all data read from this Stream.
| in | The non-null InputStream to count line numbers. |
|---|
Returns a int representing the number of bytes that are available before
this LineNumberInputStream will block. This method returns the number of
bytes available in the target stream. Since the target input stream may
just be a sequence of \r\n characters and this filter only
returns \n then available can only
guarantee target.available()/2 characters.
| IOException | If an error occurs in this stream. |
|---|
Returns a int representing the current line number for this LineNumberInputStream.
Set a Mark position in this LineNumberInputStream. The parameter
readLimit indicates how many bytes can be read before a
mark is invalidated. Sending reset() will reposition the Stream back to
the marked position provided readLimit has not been
surpassed. The lineNumber count will also be reset to the last marked
lineNumber count.
This implementation sets a mark in the target stream.
| readlimit | The number of bytes to be able to read before invalidating the mark. |
|---|
Reads at most length bytes from this LineNumberInputStream
and stores them in byte array buffer starting at
offset. Answer the number of bytes actually read or -1 if
no bytes were read and end of stream was encountered. This implementation
reads bytes 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 non-null byte array in which to store the read bytes. |
|---|---|
| offset | the offset in buffer to store the read bytes. |
| length | the maximum number of bytes to store in buffer. |
| IOException | If the stream is already closed or another IOException occurs. |
|---|---|
| NullPointerException | If buffer is null. |
| IllegalArgumentException | If offset or count are out of
bounds.
|
Reads a single byte from this LineNumberInputStream and returns the result as an int. The low-order byte is returned or -1 of the end of stream was encountered. This implementation returns a byte 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'.
| IOException | If the stream is already closed or another IOException occurs. |
|---|
Reset this LineNumberInputStream to the last marked location. If the
readlimit has been passed or no mark has
been set, throw IOException. This implementation resets the target
stream. It also resets the line count to what is was when this Stream was
marked.
| IOException | If the stream is already closed or another IOException occurs. |
|---|
Sets the lineNumber of this LineNumberInputStream 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 bytes in this InputStream.
Subsequent read()'s will not return these bytes unless
reset() is used. This implementation skips
count number of bytes in the target stream and increments
the lineNumber count as bytes are skipped.
| count | the number of bytes to skip. |
|---|
| IOException | If the stream is already closed or another IOException occurs. |
|---|