All About Class LineNumberInputStream in Java



A line is a sequence of bytes ending either a carriage return character("\r"),a new line character("\n") or a carriage return character followed immediately by a line feed character.In all these cases,the line terminating character(s) are returned as a single newline character.
LineNumberInputStream class is an input stream filter that provides the added functionality of keeping track of the current line number. The line number begins at zero and it is incremented by one when a read returns a newline character.

The structure of the class LineNumberInputStream is given as:

public class java.io.LineNumberInputStream extends java.io.FilterInputStream{
//constructor
public LineNumberInputStream(InputStream in);
//constructs a new LineNumberInputStream  which reads its input stream.
//methods
public int available();
public int read();
public int read(byte b[],int offSet,int length);
public long skip(long l);
public void mark(int readLimit);
public void reset();
public int getLineNumber();
public void setLineNumber(int lineNumber);
}
 
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class LineNumberInputStream in Java All About Class LineNumberInputStream in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5

No comments:

Powered by Blogger.