Code example for LineNumberReader

0
  LineNumberReader reader; 
  Vector lines = new Vector(); 
  int lineCount = 1; 
   
  public ReaderLineSource(Reader reader){ 
    this.reader = new LineNumberReader(reader); 
  } 
   
  /**  
   * Returns total line count in passed reader 
   */ 
  public int getLineCount(){ 
    while (getLine(lineCount) != null); 
    return lineCount; 
  } 
   
  public String getLine(int lno) { 
    while (lines.size() <= lno){ 
      String line = null; 
      try{ 
        line = reader.readLine();