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 over a given file, assuming a UTF-8 encoding.
|
FileLineIterator(File file,
boolean skipFirstLine)
Creates a over a given file, assuming a UTF-8 encoding.
|
FileLineIterator(File file,
Charset encoding,
boolean skipFirstLine)
Creates a over a given file, using the given encoding.
|
FileLineIterator(InputStream is) |
FileLineIterator(InputStream is,
boolean skipFirstLine) |
FileLineIterator(InputStream is,
Charset encoding,
boolean skipFirstLine) |
| 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, peekpublic FileLineIterator(File file) throws IOException
FileNotFoundException - if the file does not existIOException - if the file cannot be readpublic FileLineIterator(File file, boolean skipFirstLine) throws IOException
FileNotFoundException - if the file does not existIOException - if the file cannot be readpublic FileLineIterator(File file, Charset encoding, boolean skipFirstLine) throws IOException
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
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()
close in interface Closeableclose in interface AutoCloseableCopyright © 2012-2013 Myrrix Ltd. All Rights Reserved.