T
- The type that process(String, File)
returns; use "Void
" if not neededpublic class FileContentsProcessor<T> extends 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(String path,
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(String path, File file) throws FileNotFoundException, IOException
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 fileIOException
- Message should include the file nameFileNotFoundException
Copyright © 2018 Arno Unkrig. All rights reserved.