title: MalformedInputException: Input length = 1 when run over twice
body: <p>Running over a File with this Code works just fine the first time,
  but on a second Run (on the same File), <code>Files.readAllLines</code> throws said Exception.</p>
  
  <p>All the code does is (for each file but in this case it's just one)
  get all the lines from a file, delete it, and then refill it with the same content.</p>
  
  <pre><code>for (File file : content) {
      List&lt;String&gt; fillLines = new ArrayList&lt;&gt;();
      try {
          fillLines = Files.readAllLines(file.toPath());
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      if (fillLines.size() &gt; 0) {
          file.delete();
          FileWriter fileWriter = new FileWriter(file, false);
  
          for (String line : fillLines) {
              fileWriter.write(line);
              if (fillLines.indexOf(line) &lt; fillLines.size() - 1)
                  fileWriter.append(System.lineSeparator());
          }
          fileWriter.close();
      }
  }
  </code></pre>
  
  <p>Any ideas? Might be because of <code>fileWriter.append(System.lineSeparator());</code>?</p>
  
  <p>All the other Questioneers were failing the first time because of reading it with a wrong charset. But as I'm able to run it once, I'm not reading but writing something wrong, so changing the charset seems like a workaround that could be avoided.</p>
  
  <p>Stacktrace:</p>
  
  <pre><code>java.nio.charset.MalformedInputException: Input length = 1
      at java.nio.charset.CoderResult.throwException(Unknown Source)
      at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
      at sun.nio.cs.StreamDecoder.read(Unknown Source)
      at java.io.InputStreamReader.read(Unknown Source)
      at java.io.BufferedReader.fill(Unknown Source)
      at java.io.BufferedReader.readLine(Unknown Source)
      at java.io.BufferedReader.readLine(Unknown Source)
      at java.nio.file.Files.readAllLines(Unknown Source)
      at java.nio.file.Files.readAllLines(Unknown Source)
  </code></pre>
  
  <p>anything below here points to</p>
  
  <pre><code>    fillLines = Files.readAllLines(file.toPath());
  </code></pre>