Package edu.wisc.ssec.mcidasv.util
Class FileFinder.Finder
- All Implemented Interfaces:
FileVisitor<Path>
- Enclosing class:
FileFinder
Internal class used by the
findFiles(...)
methods to actually
"walk" the directory tree.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
done()
Prints the total number of matches to standard out.(package private) void
Compare the given file or directory against the glob pattern.preVisitDirectory
(Path dir, BasicFileAttributes attrs) Invokes the pattern matching method on the given directory.results()
Returns the matching paths as strings.visitFile
(Path file, BasicFileAttributes attrs) Invokes pattern matching method on the given file.visitFileFailed
(Path file, IOException exc) Handle file "visitation" errors.Methods inherited from class java.nio.file.SimpleFileVisitor
postVisitDirectory
-
Field Details
-
matcher
Pattern matcher. -
matches
String
representations of matchingPaths
.
-
-
Constructor Details
-
Finder
Creates a new file searcher.Please see
FileSystem.getPathMatcher(String)
for more details concerning patterns.- Parameters:
pattern
- Pattern to match against.
-
-
Method Details
-
find
Compare the given file or directory against the glob pattern.If
file
matches, it is added tomatches
.- Parameters:
file
- File (or directory) to compare against the glob pattern.- See Also:
-
done
void done()Prints the total number of matches to standard out. -
results
Returns the matching paths as strings.- Returns:
List
of the matching paths asString
values.
-
visitFile
Invokes pattern matching method on the given file.- Specified by:
visitFile
in interfaceFileVisitor<Path>
- Overrides:
visitFile
in classSimpleFileVisitor<Path>
- Parameters:
file
- File in question.attrs
- Attributes ofdir
. Not currently used.- Returns:
- Always returns
FileVisitResult.CONTINUE
(for now).
-
preVisitDirectory
Invokes the pattern matching method on the given directory.- Specified by:
preVisitDirectory
in interfaceFileVisitor<Path>
- Overrides:
preVisitDirectory
in classSimpleFileVisitor<Path>
- Parameters:
dir
- Directory in question.attrs
- Attributes ofdir
. Not currently used.- Returns:
- Always returns
FileVisitResult.CONTINUE
(for now).
-
visitFileFailed
Handle file "visitation" errors.- Specified by:
visitFileFailed
in interfaceFileVisitor<Path>
- Overrides:
visitFileFailed
in classSimpleFileVisitor<Path>
- Parameters:
file
- File that could not be "visited".exc
- Exception associated with "visit" tofile
.- Returns:
- Always returns
FileVisitResult.CONTINUE
(for now).
-