T - the type of elements in the iteratorpublic class BurnOnCloseFileIterator<T> extends Object implements Closeable, Iterator<T>
Closeable wrapper over a LineIterator.
Also has a transformer to transform the output. If the underlying file is
provided then it deletes the file on close().
If there is a scope for lines in the file containing line break characters it
should be ensured that the files is written with
FileIOUtils.writeAsLine(BufferedWriter, String, boolean) with true to escape
line break characters and should be properly unescaped on read. A custom
transformer can also be provided to unescape.| Constructor and Description |
|---|
BurnOnCloseFileIterator(Iterator<String> iterator,
File backingFile,
Function<String,T> transformer) |
BurnOnCloseFileIterator(Iterator<String> iterator,
Function<String,T> transformer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
hasNext() |
T |
next() |
static BurnOnCloseFileIterator<String> |
wrap(Iterator<String> iter) |
static BurnOnCloseFileIterator<String> |
wrap(Iterator<String> iter,
File backingFile) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaining, removepublic BurnOnCloseFileIterator(Iterator<String> iterator, Function<String,T> transformer)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic static BurnOnCloseFileIterator<String> wrap(Iterator<String> iter)
public static BurnOnCloseFileIterator<String> wrap(Iterator<String> iter, File backingFile)
Copyright © 2010 - 2020 Adobe. All Rights Reserved