Package eu.bandm.tools.util.files
Class FileVisitor
java.lang.Object
eu.bandm.tools.util.files.FileVisitor
- Direct Known Subclasses:
FileTree.Visitor
Applies visitor style pattern to file system trees.
-
Field Summary
FieldsModifier and TypeFieldDescriptionReceives a string in cases of errors. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor which uses System.err as an error handler.FileVisitor
(Consumer<String> errorHandler) Constructor which uses an explicit error handler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Central entry method.void
To be overwritten by payload code, if wanted.void
visitDir_pre
(File f) To be overwritten by payload code, if wanted.void
visitNonDir
(File f) To be overwritten by payload code, if wanted.
-
Field Details
-
errorHandler
Receives a string in cases of errors.
-
-
Constructor Details
-
FileVisitor
public FileVisitor()Constructor which uses System.err as an error handler. -
FileVisitor
Constructor which uses an explicit error handler.- Parameters:
errorHandler
- where to send error messages (as strings)
-
-
Method Details
-
visit
Central entry method.
Is called for applying the visitor. Normally it will not be overwritten. Calls directlyvisitNonDir(File)
orvisitDir(File)
, depending on the type of the file.- Parameters:
f
- position in the file system from which visiting shall descend.
-
visitDir_pre
To be overwritten by payload code, if wanted. Is called for every directory before descending into the contained files.- Parameters:
f
- the directory to visit
-
visitDir_post
To be overwritten by payload code, if wanted. Is called for every directory after descending into the contained files.- Parameters:
f
- the directory to visit
-
visitNonDir
To be overwritten by payload code, if wanted. Is called for every non-directory file.- Parameters:
f
- the non-directory file to visit
-