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) voiddone()Prints the total number of matches to standard out.(package private) voidCompare 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
Stringrepresentations 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
filematches, 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:
Listof the matching paths asStringvalues.
-
visitFile
Invokes pattern matching method on the given file.- Specified by:
visitFilein interfaceFileVisitor<Path>- Overrides:
visitFilein 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:
preVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
preVisitDirectoryin 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:
visitFileFailedin interfaceFileVisitor<Path>- Overrides:
visitFileFailedin classSimpleFileVisitor<Path>- Parameters:
file- File that could not be "visited".exc- Exception associated with "visit" tofile.- Returns:
- Always returns
FileVisitResult.CONTINUE(for now).
-