| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.finder.FileFinder
public class FileFinder
Searches for files that match certain criteria in a directory, and typically also subdirectories.
This is a programmatic equivalent of the search functions present in many operating systems. You can be informed dynamically of events as they occur by adding a listener.
| Field Summary | 
|---|
| Fields inherited from interface org.apache.commons.finder.Finder | 
|---|
CAN_READ, CAN_WRITE, CANNOT_READ, CANNOT_WRITE, DAYSTART, DEPTH, DIRECTORY, EMPTY, FILE, HIDDEN, IGNORE_HIDDEN_DIRS, INAME, IPATH, IREGEX, MAXDEPTH, MIN, MINDEPTH, NAME, NEWER, NOT, NOT_EMPTY, PATH, REGEX, SIZE, TIME, VISIBLE | 
| Constructor Summary | |
|---|---|
FileFinder()
Constructor.  | 
|
| Method Summary | |
|---|---|
 void | 
addFindListener(FindListener listener)
Adds a FindListener that is notified when a file is found.  | 
 java.io.File[] | 
find(java.io.File directory)
Find all files in the specified directory.  | 
 java.io.File[] | 
find(java.io.File directory,
     java.util.Map options)
Finds files in the specified directory that match the given options.  | 
 void | 
find(java.io.File directory,
     java.util.Map options,
     java.util.List foundFiles)
Finds files in the specified directory that match the given options.  | 
protected  void | 
notifyDirectoryFinished(java.io.File directory,
                        java.io.File[] files)
Notify all FindListeners that a directory has been finished.  | 
protected  void | 
notifyDirectoryStarted(java.io.File directory)
Notify all FindListeners that a directory is being started.  | 
protected  void | 
notifyFileFound(java.io.File directory,
                java.io.File file)
Notifies each FindListeners that a file has been found.  | 
 void | 
removeFindListener(FindListener listener)
Removes a FindListener.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public FileFinder()
| Method Detail | 
|---|
public java.io.File[] find(java.io.File directory)
find in interface Finderdirectory - the directory to search in
public java.io.File[] find(java.io.File directory,
                           java.util.Map options)
find in interface Finderdirectory - the directory to search inoptions - the options to use
public void find(java.io.File directory,
                 java.util.Map options,
                 java.util.List foundFiles)
Note: To avoid large memory allocations, avoid adding any FileListeners, and try overwriding List.add(Object o) instead.
directory - the directory to search inoptions - the options to usefoundFiles - a List to which all found files will be addedpublic void addFindListener(FindListener listener)
addFindListener in interface Finderlistener - the listenerpublic void removeFindListener(FindListener listener)
removeFindListener in interface Finderlistener - the listenerprotected void notifyDirectoryStarted(java.io.File directory)
directory - the directory
protected void notifyDirectoryFinished(java.io.File directory,
                                       java.io.File[] files)
directory - the directoryfiles - the files that were found in the directory
protected void notifyFileFound(java.io.File directory,
                               java.io.File file)
directory - the directory being processedfile - the file that was found
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||