title: reading from tsv file in java
body: <p>I am reading every line from tsv file using buffered reader in java, then storing it in array and printing the array. But records print from middle of the file and not the start.</p>
  
  <pre><code>public class Test {    
      public static void main(String args[]) throws IOException
      {
          UserItemsTsvParser u=new 
          UserItemsTsvParser("./data/user_items/users_movies.tsv");
          ItemsTsvParser a =new ItemsTsvParser("./data/items/books.tsv");
          while(!(a.hasReachedEndOfFile()))
               {
  
                  a.readNextLine();
  
               }  
      }
  }
  </code></pre>
  
  <p>and I am calling methods from another class:</p>
  
  <pre><code>public ItemsTsvParser(String relativeFilePath) 
          throws IOException {        
      fileReader=new BufferedReader(new FileReader(relativeFilePath));
      System.out.println(relativeFilePath);
      currentLine=fileReader.readLine();
  
  }
  
  /**
   * It reads the next line of the file.
   * @return
   * @throws IOException 
   */
  int i=0;
  public void readNextLine() throws IOException {
  
      while((currentLine=fileReader.readLine())!=null)
      {
          System.out.print(i++);
          currentLineTokens=currentLine.split("\t");
          currentItemId=currentLineTokens[0];
          currentItemType=currentLineTokens[1];
          currentItemUri=currentLineTokens[2];
          System.out.println(Arrays.toString(currentLineTokens));
      }
  }
  
  /**
   * Returns TRUE if EOF has been reached by the reader.
   * @return
   * @throws IOException 
   */
  public boolean hasReachedEndOfFile() throws IOException{
  
      if(currentLine==null)
      {
  
          return true;
      }
      else
      {
          return false;
      }
  }   
  </code></pre>