T - The type that process(String, File) returns; use "Void" if not neededpublic class FileContentsProcessor<T> extends java.lang.Object implements FileProcessor<T>
ContentsProcessor, and eventually closing
the file.| Modifier and Type | Field and Description |
|---|---|
protected ContentsProcessor<T> |
contentsProcessor
The
ContentsProcessor that is used to process a file's contents when process(String, File) is
invoked. |
| Constructor and Description |
|---|
FileContentsProcessor(ContentsProcessor<T> contentsProcessor) |
| Modifier and Type | Method and Description |
|---|---|
T |
process(java.lang.String path,
java.io.File file)
Opens the
file, passes the input stream to ContentsProcessor.process(String, InputStream, long,
long, ProducerWhichThrows), then closes the file. |
protected final ContentsProcessor<T> contentsProcessor
ContentsProcessor that is used to process a file's contents when process(String, File) is
invoked.public FileContentsProcessor(ContentsProcessor<T> contentsProcessor)
@Nullable public T process(java.lang.String path, java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file, passes the input stream to ContentsProcessor.process(String, InputStream, long,
long, ProducerWhichThrows), then closes the file.
Subclasses may override this behavior, e.g. by recursing into directories or archives.
process in interface FileProcessor<T>path - The string that characterizes the filejava.io.IOException - Message should include the file namejava.io.FileNotFoundException