Class BurnOnCloseFileIterator<T>
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator<T>
-
- Type Parameters:
T
- the type of elements in the iterator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<T>
public class BurnOnCloseFileIterator<T> extends Object implements Closeable, Iterator<T>
Implements aCloseable
wrapper over aLineIterator
. Also has a transformer to transform the output. If the underlying file is provided then it deletes the file onclose()
. If there is a scope for lines in the file containing line break characters it should be ensured that the files is written withFileIOUtils.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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
hasNext()
T
next()
static BurnOnCloseFileIterator<String>
wrap(Iterator<String> iter)
static BurnOnCloseFileIterator<String>
wrap(Iterator<String> iter, File backingFile)
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
wrap
public static BurnOnCloseFileIterator<String> wrap(Iterator<String> iter)
-
wrap
public static BurnOnCloseFileIterator<String> wrap(Iterator<String> iter, File backingFile)
-
-