public final class FileLineIterator extends com.google.common.collect.AbstractIterator<String> implements SkippingIterator<String>, Closeable
BufferedReader defines lines.
This class will uncompress files that end in .zip or .gz accordingly, too.| Constructor and Description |
|---|
FileLineIterator(File file)
Creates a
FileLineIterator over a given file, assuming a UTF-8 encoding. |
FileLineIterator(File file,
boolean skipFirstLine)
Creates a
FileLineIterator over a given file, assuming a UTF-8 encoding. |
FileLineIterator(File file,
Charset encoding,
boolean skipFirstLine)
Creates a
FileLineIterator over a given file, using the given encoding. |
FileLineIterator(InputStream is) |
FileLineIterator(InputStream is,
boolean skipFirstLine) |
FileLineIterator(InputStream is,
Charset encoding,
boolean skipFirstLine) |
FileLineIterator(InputStream is,
Charset encoding,
boolean skipFirstLine,
String filename) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected String |
computeNext() |
void |
skip(int n)
Skip the next n elements supplied by this
Iterator. |
endOfData, hasNext, next, peekclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaining, hasNext, next, removepublic FileLineIterator(File file) throws IOException
FileLineIterator over a given file, assuming a UTF-8 encoding.FileNotFoundException - if the file does not existIOException - if the file cannot be readpublic FileLineIterator(File file, boolean skipFirstLine) throws IOException
FileLineIterator over a given file, assuming a UTF-8 encoding.FileNotFoundException - if the file does not existIOException - if the file cannot be readpublic FileLineIterator(File file, Charset encoding, boolean skipFirstLine) throws IOException
FileLineIterator over a given file, using the given encoding.FileNotFoundException - if the file does not existIOException - if the file cannot be readpublic FileLineIterator(InputStream is) throws IOException
IOExceptionpublic FileLineIterator(InputStream is, boolean skipFirstLine) throws IOException
IOExceptionpublic FileLineIterator(InputStream is, Charset encoding, boolean skipFirstLine) throws IOException
IOExceptionpublic FileLineIterator(InputStream is, Charset encoding, boolean skipFirstLine, String filename) throws IOException
IOExceptionprotected String computeNext()
computeNext in class com.google.common.collect.AbstractIterator<String>public void skip(int n)
SkippingIteratorIterator. If there are less than n elements remaining,
this skips all remaining elements in the Iterator. This method has the same effect as calling
Iterator.next() n times, except that it will never throw NoSuchElementException.skip in interface SkippingIterator<String>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.