org.glassfish.pfl.basic.tools.file
Class Scanner

java.lang.Object
  extended by org.glassfish.pfl.basic.tools.file.Scanner

public class Scanner
extends Object

Recursively scan directories to process files.


Nested Class Summary
static interface Scanner.Action
          Action interface passed to scan method to act on files.
 
Constructor Summary
Scanner(int verbose, File... files)
           
Scanner(int verbose, List<File> files)
           
 
Method Summary
 void addDirectoryToSkip(String pattern)
          Add a pattern that defines a directory to skip.
 boolean scan(Scanner.Action action)
          Scan all files reachable from roots.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scanner

public Scanner(int verbose,
               List<File> files)

Scanner

public Scanner(int verbose,
               File... files)
Method Detail

addDirectoryToSkip

public void addDirectoryToSkip(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.


scan

public boolean scan(Scanner.Action action)
             throws IOException
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


Copyright © 2013 Oracle. All Rights Reserved.