|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gargoylesoftware.base.util.DirectoryWalker
A class to walk through the directory structure from a given starting point and return either files or directories or both.
The following sample gets all java files.
final FileFilter filter = new FileFilter() { public boolean accept( final File file ) { return file.getName().endsWith(".java"); } }; final DirectoryWalker directoryWalker = new DirectoryWalker("."); final Collection files = directoryWalker.getFiles(filter);
Constructor Summary | |
DirectoryWalker(String startingDirectory)
Create an instance |
Method Summary | |
Collection |
getDirectories(FileFilter filter)
Walk through the directory structure and return a collection containing all those directories for which the filter returns true |
Collection |
getFiles(FileFilter filter)
Walk through the directory structure and return a collection containing all those files for which the filter returns true |
Collection |
getFilesAndDirectories(FileFilter filter)
Walk through the directory structure and return a collection containing all those files and directories for which the filter returns true |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DirectoryWalker(String startingDirectory)
startingDirectory
- the directory to start inMethod Detail |
public Collection getFiles(FileFilter filter)
filter
- An object to determine whether or not to include this file
in the returned collection
public Collection getDirectories(FileFilter filter)
filter
- An object to determine whether or not to include this
directory in the returned collection
public Collection getFilesAndDirectories(FileFilter filter)
filter
- An object to determine whether or not to include this
file/directory in the returned collection
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |