title: counting file length in java: FileReader vs. File.length
body: <p>Why would fr_count and len be different in the code below?</p>
  
  <pre><code>FileReader fr = new FileReader(filename);
  int c;
  long fr_count = 0;
  while ( -1 != (c = fr.read()) ) 
      fr_count++;
  long len = new File(filename).length();
  </code></pre>
  
  <p>I've used the code above on two files. Here are the results: </p>
  
  <pre><code>test.txt
   FileReader:  263742
   File.length: 265963
  output.enc
   FileReader:  146360
   File.length: 212998
  </code></pre>