public class LocalFileFinder extends SimpleFileVisitor<Path>
SimpleFileVisitor
and overrides
the file and the directory visit methods. It is essentially an implementation
of the visitor pattern.Modifier and Type | Method and Description |
---|---|
List<String> |
getMatchingFileNames() |
int |
getNumMatches() |
List<String> |
getRemoteFileNames() |
FileVisitResult |
preVisitDirectory(Path dir,
BasicFileAttributes attrs)
This method is automatically called as a directory is found.
|
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attrs)
This method is automatically called as a file is found.
|
FileVisitResult |
visitFileFailed(Path file,
IOException exc)
This method is called in case there is an exception raised while
traversing a directory tree.
|
postVisitDirectory
public int getNumMatches()
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
visitFile
in interface FileVisitor<Path>
visitFile
in class SimpleFileVisitor<Path>
file
- - the Path
representing the file.attrs
- - the attributes BasicFileAttributes
of the file.FileVisitResult
object used internally by the
FileWalker.public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
preVisitDirectory
in interface FileVisitor<Path>
preVisitDirectory
in class SimpleFileVisitor<Path>
dir
- - The Path
object representing the directory foundattrs
- - the attributes BasicFileAttributes
of the
directory.FileVisitResult
object used internally by the
FileWalker.public FileVisitResult visitFileFailed(Path file, IOException exc)
visitFileFailed
in interface FileVisitor<Path>
visitFileFailed
in class SimpleFileVisitor<Path>
file
- - the file Path objectexc
- - the IOException objectFileVisitResult
objectCopyright © 2024. All rights reserved.