LineNumberReader class in java

0
22
Spread the love
  • 23
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    160
    Shares

LineNumberReader class in java

LineNumberReader is a character input stream that keeps track of the number of lines of text that have been read from it. It supports the usual Reader methods, and also the readLine() method introduced by its superclass. In addition to these methods, we can call gettLineNumber() to query the number of lines set so far.

We can also call setLineNumber() to set the line number for the current line. Subsequent lines are numbered sequentially from this specified starting point.

This class is a character stream analog to LineNumberInputStream, which has been deprecated in Java 1.1

The Class Structure of the LineNumberReader is given as

public class java.io.LineNumberReader extends java.io.BufferedReader
// Public Constructors
public LineNumberReader(Reader in);
public LineNumberReader(Reader in, int size); 
// Public Instance Methods
public int getLineNumber(); 
public void mark(int readAheadlimit) throws IOException;//Overrides BufferedReader 
public int read() throws IOException;//Overrides BufferedReader
public int read(char [ ] cbuf, int off, int len) throws IOException;//Overrides BufferedReader
public String readLine()throws IOException;//Overrides BufferedReader
public void reset() throws IOException;// Overrides BufferedReader
public void setLineNumber(int lineNumber);
public long skip (long n) throws IOException;// Overrides BufferedReader
}
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 23
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    160
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here