T - the type of elements in the iteratorpublic static class FileIOUtils.BurnOnCloseFileIterator<T> extends com.google.common.collect.AbstractIterator<T> implements Closeable
Closeable wrapper over a LineIterator.
Also has a transformer to transform the output. If the underlying file is
provide 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(org.apache.commons.io.LineIterator iterator,
File backingFile,
com.google.common.base.Function<String,T> transformer) |
BurnOnCloseFileIterator(org.apache.commons.io.LineIterator iterator,
com.google.common.base.Function<String,T> transformer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected T |
computeNext() |
static FileIOUtils.BurnOnCloseFileIterator<String> |
wrap(org.apache.commons.io.LineIterator iter) |
static FileIOUtils.BurnOnCloseFileIterator<String> |
wrap(org.apache.commons.io.LineIterator iter,
File backingFile) |
endOfData, hasNext, next, peekclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic BurnOnCloseFileIterator(org.apache.commons.io.LineIterator iterator,
com.google.common.base.Function<String,T> transformer)
protected T computeNext()
computeNext in class com.google.common.collect.AbstractIterator<T>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic static FileIOUtils.BurnOnCloseFileIterator<String> wrap(org.apache.commons.io.LineIterator iter)
public static FileIOUtils.BurnOnCloseFileIterator<String> wrap(org.apache.commons.io.LineIterator iter, File backingFile)
Copyright © 2012–2017 The Apache Software Foundation. All rights reserved.