title: How to skip between lines while parsing a text file in java
body: <p>I am writing a compiler program to read a text file. Some of the commands in the text file will tell me to skip back to a certain line in the text file and read from there. As things are, this code I have reads one line at a time until the end of the document. Is there anyway to have a parser skip back or forward to a certain line in the text file? Let us say for example I am currently on line 8 and the instruction is to go back and read line 4?</p>
  
  <p>Here is my code for parsing the file.</p>
  
  <pre><code>try {
      FileInputStream fstream = new FileInputStream("compilers.txt");
      BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
      String strLine;
  
      while ((strLine = br.readLine()) != null &amp;&amp; checker == false) {
          // rest of code in here
      }
      in.close();
  }
  </code></pre>