Class Scanner
java.lang.Object
org.glassfish.pfl.basic.tools.file.Scanner
Recursively scan directories to process files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Action interface passed to scan method to act on files. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDirectoryToSkip
(String pattern) Add a pattern that defines a directory to skip.private boolean
doScan
(File file, Scanner.Action action) private boolean
boolean
scan
(Scanner.Action action) Scan all files reachable from roots.private boolean
skipDirectory
(File file)
-
Field Details
-
roots
-
verbose
private final int verbose -
patternsToSkip
-
-
Constructor Details
-
Scanner
-
Scanner
-
-
Method Details
-
addDirectoryToSkip
Add a pattern that defines a directory to skip. We only need really simple patterns: just a single name that must match a component of a directory name exactly. -
scan
Scan all files reachable from roots. Does a depth-first search. Ignores all directories (and their contents) that match an entry in patternsToSkip. Passes each file (not directories) to the action. If action returns false, scan terminates. The result of the scan is the result of the last action call.- Throws:
IOException
-
doScan
- Throws:
IOException
-
skipDirectory
-
match
-