edu.umd.cs.findbugs
Class RecursiveFileSearch
java.lang.Object
edu.umd.cs.findbugs.RecursiveFileSearch
public class RecursiveFileSearch
- extends java.lang.Object
Recursively search a directory, its subdirectories, etc.
Note that the search algorithm uses a worklist, so its implementation does
not use recursive method calls.
- Author:
- David Hovemeyer
Constructor Summary |
RecursiveFileSearch(java.lang.String baseDir,
java.io.FileFilter fileFilter)
Constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
baseDir
private java.lang.String baseDir
fileFilter
private java.io.FileFilter fileFilter
directoryWorkList
private java.util.LinkedList<java.io.File> directoryWorkList
resultList
private java.util.ArrayList<java.lang.String> resultList
RecursiveFileSearch
public RecursiveFileSearch(java.lang.String baseDir,
java.io.FileFilter fileFilter)
- Constructor.
- Parameters:
baseDir
- the base directory for the searchfileFilter
- chooses files to add to the results, and subdirectories
to continue the search in
search
public RecursiveFileSearch search()
throws java.lang.InterruptedException
- Perform the search.
- Returns:
- this object
- Throws:
java.lang.InterruptedException
- if the thread is interrupted before the
search completes
fileNameIterator
public java.util.Iterator<java.lang.String> fileNameIterator()
- Get an iterator over the files found by the search.
The full path names of the files are returned.