public static LineIterator lineIterator(InputStream input, Charset encoding) throws IOException {
        return new LineIterator(new InputStreamReader(input, Charsets.toCharset(encoding)));
    }
public static LineIterator lineIterator ( InputStream input , Charset encoding ) throws IOException { return new LineIterator ( new InputStreamReader ( input , Charsets . toCharset ( encoding ) ) ) ; }
Return an Iterator for the lines in an <code>InputStream</code>, using
the character encoding specified (or default encoding if null).
<p/>
<code>LineIterator</code> holds a reference to the open
<code>InputStream</code> specified here. When you have finished with
the iterator you should close the stream to free internal resources.
This can be done by closing the stream directly, or by calling
<p/>
The recommended usage pattern is:
<pre>
try {
LineIterator it = IOUtils.lineIterator(stream, charset);
while (it.hasNext()) {
String line = it.nextLine();
/// do something with line
}
} finally {
IOUtils.closeQuietly(stream);
}
</pre>

@param input    the <code>InputStream</code> to read from, not null
@param encoding the encoding to use, null means platform default
@return an Iterator of the lines in the reader, never null
@throws IllegalArgumentException if the input is null
@throws IOException              if an I/O error occurs, such as if the encoding is invalid
@since 2.3