Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 147
نمايش فراداده

This class 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, you can call getLineNumber( ) to query the number of lines set so far. You 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 as of Java 1.1.

Figure 9-32. java.io.LineNumberReader

public class 

LineNumberReader extends BufferedReader { // Public Constructors public

LineNumberReader (Reader

in ); public

LineNumberReader (Reader

in , int

sz ); // Public Instance Methods public int

getLineNumber ( ); public void

setLineNumber (int

lineNumber ); // Public Methods Overriding BufferedReader public void

mark (int

readAheadLimit ) throws IOException; public int

read ( ) throws IOException; public int

read (char[ ]

cbuf , int

off , int

len ) throws IOException; public String

readLine ( ) throws IOException; public void

reset ( ) throws IOException; public long

skip (long

n ) throws IOException; }