title: BufferedReader readLine() issue: detecting end of file and empty return lines
body: <p>I want my program to do something when it finds the end of a file (EOF) at the end of the last line of text, and something else when the EOF is at the empty line AFTER that last line of text. Unfortunately, BufferedReader seems to consider both cases equal.</p>
  
  <p>For example, this is my code to read the lines to the end of the file:</p>
  
  <pre><code>FileReader fr = new FileReader("file.txt");
  BufferedReader br = new BufferedReader(fr);
  String line;
  
  while((line = br.readLine()) != null) {
      if (line.equals("")) {
          System.out.println("Found an empty line at end of file.");
      }
  }
  </code></pre>
  
  <p>If file.txt contained this, it wouldn't print:</p>
  
  <pre><code>line of text 1
  another line 2//cursor
  </code></pre>
  
  <p>This wouldn't print either:</p>
  
  <pre><code>line of text 1
  another line 2
  //cursor
  </code></pre>
  
  <p>However, this will:</p>
  
  <pre><code>line of text 1
  another line 2
  
  //cursor
  </code></pre>
  
  <p>What reader can I use to differentiate the first two cases?</p>