Code example for LineNumberReader

  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; 
Connect your IDE to all the code out there  Get Codota for Java