title: Files.lines to skip broken lines in Java8
body: <p>I am reading a very large (500mb) file with Files.lines(...).
  It reads a part of the file but at some point it breaks with java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1</p>
  
  <p>I think the file has lines with different charsets. Is there a way to skip these broken lines? I know that the stream returned is backed by a Reader and with the reader I know how to skip, but don't know how to get the Reader from the stream to set it up as I like.</p>
  
  <pre><code>    List&lt;String&gt; lines = new ArrayList&lt;&gt;();
      try (Stream&lt;String&gt; stream = Files.lines(Paths.get(getClass().getClassLoader().getResource("bigtest.txt").toURI()), Charset.forName("UTF-8"))) {
          stream
              .filter(s -&gt; s.substring(0, 2).equalsIgnoreCase("aa"))
              .forEach(lines::add);
      } catch (final IOException e) {
          // catch
      }
  </code></pre>