public class FilePathProcessor
extends java.lang.Object
FilePathProcessor
traverses a directory structure and
applies the processFile
method to files meeting some
criterion. It is implemented as static methods, not as an extension of
File
.
Note: This is used in our old code in ling/trees, but newer code should probably use io.FileSequentialCollection
Modifier and Type | Method and Description |
---|---|
static void |
processPath(java.io.File path,
java.io.FileFilter filter,
FileProcessor processor)
Apply a function to the files under a given directory and
perhaps its subdirectories.
|
static void |
processPath(java.io.File path,
java.lang.String suffix,
boolean recursively,
FileProcessor processor)
Apply a method to the files under a given directory and
perhaps its subdirectories.
|
static void |
processPath(java.lang.String pathStr,
java.lang.String suffix,
boolean recursively,
FileProcessor processor)
Apply a method to the files under a given directory and
perhaps its subdirectories.
|
public static void processPath(java.lang.String pathStr, java.lang.String suffix, boolean recursively, FileProcessor processor)
pathStr
- file or directory to load from as a Stringsuffix
- suffix (normally "File extension") of files to loadrecursively
- true means descend into subdirectories as wellprocessor
- The FileProcessor
to apply to each
File
public static void processPath(java.io.File path, java.lang.String suffix, boolean recursively, FileProcessor processor)
path
- file or directory to load fromsuffix
- suffix (normally "File extension") of files to loadrecursively
- true means descend into subdirectories as wellprocessor
- The FileProcessor
to apply to each
File
public static void processPath(java.io.File path, java.io.FileFilter filter, FileProcessor processor)
path
is a file, then
that file is processed regardless of whether it satisfies the
filter. (This semantics was adopted, since otherwise there was no
easy way to go through all the files in a directory without
descending recursively via the specification of a
FileFilter
.)path
- file or directory to load fromfilter
- a FileFilter of files to load. The filter may be null,
and then all files are processed.processor
- The FileProcessor
to apply to each
File