title: Reading file gives more lines
body: <p>I have a text file with 201288 lines:</p>
  
  <pre><code>$ wc -l text_in.txt 
  201288 text_in.txt
  </code></pre>
  
  <p>I want to read that file line by line, remove all non alphanumeric characters and print every line in a new file. After having done that, I noticed that the new file has more lines. I tried two things and both gave me different results:</p>
  
  <pre><code>PrintWriter out = new PrintWriter(fileOut);
  BufferedReader br = new BufferedReader(new FileReader(fileIn));
  String s;
  while ((s = br.readLine()) != null)
  {
      out.println(s);
      out.flush();
  }
  
  $ wc -l text_out.txt 
  201995 text_out.txt
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>try (Stream&lt;String&gt; stream = Files.lines(Paths.get(fileIn))) {
      stream.forEach(line -&gt; out.println(line));
  } catch (IOException e) {
      e.printStackTrace();
  }
  
  $ wc -l text_out.txt 
  201932 text_out.txt
  </code></pre>
  
  <p>What seems to be the correct way to do this?</p>