T - the type of elements in the iteratorpublic class BurnOnCloseFileIterator<T>
extends java.lang.Object
implements java.io.Closeable, java.util.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(java.util.Iterator<java.lang.String> iterator,
java.io.File backingFile,
java.util.function.Function<java.lang.String,T> transformer) |
BurnOnCloseFileIterator(java.util.Iterator<java.lang.String> iterator,
java.util.function.Function<java.lang.String,T> transformer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
hasNext() |
T |
next() |
static BurnOnCloseFileIterator<java.lang.String> |
wrap(java.util.Iterator<java.lang.String> iter) |
static BurnOnCloseFileIterator<java.lang.String> |
wrap(java.util.Iterator<java.lang.String> iter,
java.io.File backingFile) |
public BurnOnCloseFileIterator(java.util.Iterator<java.lang.String> iterator,
java.util.function.Function<java.lang.String,T> transformer)
public BurnOnCloseFileIterator(java.util.Iterator<java.lang.String> iterator,
java.io.File backingFile,
java.util.function.Function<java.lang.String,T> transformer)
public boolean hasNext()
hasNext in interface java.util.Iterator<T>public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic static BurnOnCloseFileIterator<java.lang.String> wrap(java.util.Iterator<java.lang.String> iter)
public static BurnOnCloseFileIterator<java.lang.String> wrap(java.util.Iterator<java.lang.String> iter, java.io.File backingFile)
Copyright © 2010 - 2023 Adobe. All Rights Reserved