View Javadoc

1   package net.sf.jpkgmk.util;
2   
3   import java.io.BufferedReader;
4   import java.io.IOException;
5   import java.io.Reader;
6   
7   
8   /**
9    * @author gommma (gommma AT users.sourceforge.net)
10   * @author Last changed by: $Author: gommma $
11   * @version $Revision: 2 $ $Date: 2008-08-20 21:14:19 +0200 (Mi, 20 Aug 2008) $
12   * @since 1.0
13   */
14  public class LineCountingReader extends BufferedReader
15  {
16  	private int lineNumber = 0;
17  
18  
19  	public LineCountingReader(Reader reader) {
20  		super(reader);
21  	}
22  
23  	
24  	@Override
25  	public String readLine() throws IOException {
26  		String result = super.readLine();
27  		lineNumber++;
28  		return result;
29  	}
30  
31  	public int currentLineNumber() {
32  		return this.lineNumber;
33  	}
34  }