Package hudson.util
Class FileVisitor
java.lang.Object
hudson.util.FileVisitor
- Direct Known Subclasses:
Archiver
Visits files in a directory recursively.
- Since:
- 1.343
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Some visitors can handle symlinks as symlinks.abstract void
Called for each file and directory that matches the criteria implied byDirScanner
void
visitSymlink
(File link, String target, String relativePath) Some visitors can handle symlinks as symlinks.final FileVisitor
with
(FileFilter f) Decorates a visitor by a given filter.
-
Constructor Details
-
FileVisitor
public FileVisitor()
-
-
Method Details
-
visit
Called for each file and directory that matches the criteria implied byDirScanner
- Parameters:
f
- Either a file or a directory.relativePath
- The file/directory name in question- Throws:
IOException
-
visitSymlink
Some visitors can handle symlinks as symlinks. Those visitors should implement this method to provide a different handling for symlink.This method is invoked by those
DirScanner
s that can handle symlinks as symlinks. (Not everyDirScanner
s are capable of doing that, as proper symlink handling requires letting visitors decide whether or not to descend into a symlink directory.)- Throws:
IOException
-
understandsSymlink
public boolean understandsSymlink()Some visitors can handle symlinks as symlinks. Those visitors should implement this method and return true to have callers invokevisitSymlink(File, String, String)
. Note that failures to detect or read symlinks on certain platforms can causevisit(java.io.File, java.lang.String)
to be called on a file which is actually a symlink. -
with
Decorates a visitor by a given filter.
-