public class LineNumberInputStream extends FilterInputStream

This class was deprecated.
This class incorrectly assumes that bytes adequately represent characters. As of JDK 1.1, the preferred way to operate on character streams is via the new character-stream classes, which include a class for counting line numbers.

This class is an input stream filter that provides the added functionality of keeping track of the current line number.

A line is a sequence of bytes ending with a carriage return character ('\r'), a newline character ('\n'), or a carriage return character followed immediately by a linefeed character. In all three cases, the line terminating character(s) are returned as a single newline character.

The line number begins at 0, and is incremented by 1 when a read returns a newline character.

See Also

Inherited Field Summary

Public Constructor Summary

LineNumberInputStream(InputStream in)
Constructs a newline number input stream that reads its input from the specified input stream.

Public Method Summary

Returns the number of bytes that can be read from this input stream without blocking.
Returns the current line number.
mark(int readlimit)
Marks the current position in this input stream.
Reads the next byte of data from this input stream.
read(byte[] b, int off, int len)
Reads up to len bytes of data from this input stream into an array of bytes.
Repositions this stream to the position at the time the mark method was last called on this input stream.
setLineNumber(int lineNumber)
Sets the line number to the specified argument.
skip(long n)
Skips over and discards n bytes of data from this input stream.

Inherited Method Summary