wt.tools.path
Class Search

java.lang.Object
  extended bywt.tools.path.Search

public class Search
extends Object

Search provides that a means of executing a search through a path (list of directories), looking for files that match a specified pattern. For each file found, a method can be executed. The method is defined by implemented FileFunction and implementing the required methods. FileDescriptionPrint provides the default method execution for each file. It prints a file description to the standard output stream.

    Example:
       Search search = new Search( new FileDescriptionPrint() );

       // This execute will list all files named My.class,
       // that are found under c:\myclasses.
       search.execute( "c:\myclasses", "My*.class" )

  

See Also:
FileFunction, FileDescriptionPrint

Field Summary
protected  String currentEntry
           
protected  FileFunction fileFunction
           
protected static int PATTERN
           
protected static int PATTERN_BEGIN
           
protected static int PATTERN_END
           
protected  String[][] patternPieces
           
protected  boolean recurse
           
 
Constructor Summary
Search(FileFunction theFileFunction)
           
 
Method Summary
 void execute(String path, String thePatterns)
           
protected  boolean isPatternMatch(String fileEntry)
           
static void main(String[] args)
           
protected  void processDirectory(File directory)
           
protected  void processPathEntry(File entry)
           
protected  void processZipFile(File file)
           
 void setRecurse(boolean recurse)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN

protected static final int PATTERN
See Also:
Constant Field Values

PATTERN_BEGIN

protected static final int PATTERN_BEGIN
See Also:
Constant Field Values

PATTERN_END

protected static final int PATTERN_END
See Also:
Constant Field Values

patternPieces

protected String[][] patternPieces

currentEntry

protected String currentEntry

recurse

protected boolean recurse

fileFunction

protected FileFunction fileFunction
Constructor Detail

Search

public Search(FileFunction theFileFunction)
Method Detail

execute

public void execute(String path,
                    String thePatterns)

isPatternMatch

protected boolean isPatternMatch(String fileEntry)

main

public static void main(String[] args)

processDirectory

protected void processDirectory(File directory)

processPathEntry

protected void processPathEntry(File entry)

processZipFile

protected void processZipFile(File file)

setRecurse

public void setRecurse(boolean recurse)