Top Description Inners Fields Constructors Methods
org.glassfish.pfl.basic.tools.file

public Class Scanner

extends Object
Class Inheritance
Imports
java.io.File, .IOException, java.util.ArrayList, .List, .StringTokenizer, org.glassfish.pfl.basic.func.UnaryPredicate

Recursively scan directories to process files.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Scanner.Action

References Deprecated UnaryPredicate is deprecated or references (maybe indirectly) at least one deprecated element.
Action interface passed to scan method to act on files.

Field Summary

Modifier and TypeField and Description
private List<String>
private final List<File>
private final int

Constructor Summary

AccessConstructor and Description
public
Scanner(int verbose, final List<File> files)

public
Scanner(final int verbose, final File... files)

Method Summary

Modifier and TypeMethod and Description
public void
addDirectoryToSkip(final String pattern)

Add a pattern that defines a directory to skip.

private boolean
doScan(final File file, final Scanner.Action action)
References Deprecated Scanner.Action is deprecated or references (maybe indirectly) at least one deprecated element.

private boolean
match(final String pattern, final String fname)

public boolean
scan(final Scanner.Action action)
References Deprecated Scanner.Action is deprecated or references (maybe indirectly) at least one deprecated element.

Scan all files reachable from roots.

private boolean
skipDirectory(final File file)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

patternsToSkipback to summary
private List<String> patternsToSkip
rootsback to summary
private final List<File> roots
verboseback to summary
private final int verbose

Constructor Detail

Scannerback to summary
public Scanner(int verbose, final List<File> files)
Scannerback to summary
public Scanner(final int verbose, final File... files)

Method Detail

addDirectoryToSkipback to summary
public void addDirectoryToSkip(final String pattern)

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.

doScanback to summary
private boolean doScan(final File file, final Scanner.Action action) throws IOException

References Deprecated

Scanner.Action is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

matchback to summary
private boolean match(final String pattern, final String fname)
scanback to summary
public boolean scan(final Scanner.Action action) throws IOException

References Deprecated

Scanner.Action is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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.

skipDirectoryback to summary
private boolean skipDirectory(final File file)
org.glassfish.pfl.basic.tools.file back to summary

public Interface Scanner.Action

extends UnaryPredicate<FileWrapper>
Known Direct Implementers
org.glassfish.pfl.basic.tools.file.Recognizer

References Deprecated

UnaryPredicate is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Action interface passed to scan method to act on files. Terminates scan if it returns false.

Method Summary

Inherited from org.glassfish.pfl.basic.func.UnaryPredicate:
evaluatetest