|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.LineNumberInputStream
LineNumberReader
@Deprecated public class LineNumberInputStream
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'.
| Field Summary |
|---|
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
LineNumberInputStream(InputStream in)
Deprecated. Constructs a new LineNumberInputStream on the InputStream in. |
|
| Method Summary | |
|---|---|
int |
available()
Deprecated. Returns a int representing the number of bytes that are available before this LineNumberInputStream will block. |
int |
getLineNumber()
Deprecated. Returns a int representing the current line number for this LineNumberInputStream. |
void |
mark(int readlimit)
Deprecated. Set a Mark position in this LineNumberInputStream. |
int |
read()
Deprecated. Reads a single byte from this LineNumberInputStream and returns the result as an int. |
int |
read(byte[] buffer,
int offset,
int length)
Deprecated. Reads at most length bytes from this LineNumberInputStream
and stores them in byte array buffer starting at
offset. |
void |
reset()
Deprecated. Reset this LineNumberInputStream to the last marked location. |
void |
setLineNumber(int lineNumber)
Deprecated. Sets the lineNumber of this LineNumberInputStream to the specified lineNumber. |
long |
skip(long count)
Deprecated. Skips count number of bytes in this InputStream. |
| 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.
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.| Method Detail |
|---|
public int available()
throws IOException
\r\n characters and this filter only
returns \n then available can only
guarantee target.available()/2 characters.
- Overrides:
available in class FilterInputStream
- Returns:
- int the number of bytes available before blocking.
- Throws:
IOException - If an error occurs in this stream.
public int getLineNumber()
public void mark(int readlimit)
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.
mark in class FilterInputStreamreadlimit - The number of bytes to be able to read before invalidating the
mark.
public int read()
throws IOException
read in class FilterInputStreamIOException - If the stream is already closed or another IOException
occurs.
public int read(byte[] buffer,
int offset,
int length)
throws IOException
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'.
read in class FilterInputStreambuffer - 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.
public void reset()
throws IOException
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.
reset in class FilterInputStreamIOException - If the stream is already closed or another IOException
occurs.public void setLineNumber(int lineNumber)
lineNumber. Note that this may have side effects on the
line number associated with the last marked position.
lineNumber - the new lineNumber value.
public long skip(long count)
throws IOException
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.
skip in class FilterInputStreamcount - the number of bytes to skip.
IOException - If the stream is already closed or another IOException
occurs.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||