| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.file.FileFinder
public class FileFinder
Helper class with convenient methods to find files.
| Constructor Summary | |
|---|---|
| protected  | FileFinder()Initialize the new instance with default values. | 
| Method Summary | |
|---|---|
| protected  File[] | collectFiles(String dir,
             String pattern,
             boolean recursive,
             Character digitWildcard) | 
|  boolean | directoryEnd(File dir)This method is called for each directory, that a FileWalker finished to walk through. | 
|  boolean | directoryStart(File dir,
               int count)This method is called for each directory, that a FileWalker starts to walk through. | 
| static File | findFile(String filename)Tries to find the file with the given Name. | 
| static File | findFileOnClasspath(String filename)Tries to find the file with the given Name on the classpath. | 
| static File[] | findFiles(String dir,
          String pattern)Return all files that match the given pattern(s) start searching in the specified dir. | 
| static File[] | findFiles(String dir,
          String pattern,
          boolean recursive)Return all files that match the given pattern(s) start searching in the specified dir. | 
| static File[] | findFiles(String dir,
          String pattern,
          boolean recursive,
          char digitWildcard)Return all files that match the given pattern(s) start searching in the specified dir. | 
| protected  List | getCollectedFiles() | 
|  boolean | handleException(Exception ex,
                File file)This method is called for whenever an exception occurs in walking through the directories. | 
|  boolean | handleFile(File file)This method is called for each file, that a FileWalker instance finds. | 
| protected  void | setCollectedFiles(List newValue) | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
protected FileFinder()
| Method Detail | 
|---|
protected List getCollectedFiles()
protected void setCollectedFiles(List newValue)
public static File findFileOnClasspath(String filename)
public static File findFile(String filename)
public static File[] findFiles(String dir,
                               String pattern)
dir - The directory to start searching (must not be null)pattern - The pattern(s) the filenames must match (must not be null )
IllegalArgumentException - If dir or pattern is null
public static File[] findFiles(String dir,
                               String pattern,
                               boolean recursive)
dir - The directory to start searching (must not be null)pattern - The pattern(s) the filenames must match (must not be null )recursive - If false, only dir is searched, otherwise all sub directories as well
IllegalArgumentException - If dir or pattern is null
public static File[] findFiles(String dir,
                               String pattern,
                               boolean recursive,
                               char digitWildcard)
dir - The directory to start searching (must not be null)pattern - The pattern(s) the filenames must match (must not be null )recursive - If false, only dir is searched, otherwise all sub directories as welldigitWildcard - The wildcard character for digit representation in the pattern(s)
IllegalArgumentException - If dir or pattern is nullpublic boolean handleFile(File file)
handleFile in interface FileHandlerThe - file, currently found by the FileWalker instance
public boolean handleException(Exception ex,
                               File file)
handleException in interface FileHandlerex - The exception to handleThe - file, currently found by the FileWalker instance
public boolean directoryEnd(File dir)
directoryEnd in interface FileHandlerdir - The directory, the FileWalker has finished to walk through
public boolean directoryStart(File dir,
                              int count)
directoryStart in interface FileHandlerdir - The directory, the FileWalker is starting to walk throughcount - The number of files and directories the FileWalker found in the directory
protected File[] collectFiles(String dir,
                              String pattern,
                              boolean recursive,
                              Character digitWildcard)
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||