cds.util
Class DirTree
java.lang.Object
cds.util.DirTree
- public class DirTree
- extends java.lang.Object
Constructor Summary |
DirTree(java.lang.String directoryString,
boolean recurse,
java.lang.String[] extensions)
Builds the tree of directories and files from the given root.
|
Method Summary |
java.util.ArrayList |
getFileList()
Provide the list of File instances with the specified extension in the specified directory
tree. |
private void |
processDirectory(java.io.File directory,
boolean recurse)
Processes directory (and its subdirectories), adding file satisfying the
file filter onto the fileList arraylist. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dirFilter
private java.io.FileFilter dirFilter
extFilter
private java.io.FileFilter extFilter
rootDirectory
private java.io.File rootDirectory
fileList
private java.util.ArrayList fileList
dirList
private java.util.ArrayList dirList
DirTree
public DirTree(java.lang.String directoryString,
boolean recurse,
java.lang.String[] extensions)
throws java.io.IOException,
java.lang.IllegalArgumentException
- Builds the tree of directories and files from the given root.
Use the extension to limit the search
- Parameters:
directoryString
- A directory namerecurse
- if true, trat all subdirectoriesextensions
- An array of extensions, such as ".java"
- Throws:
java.io.IOException
- Description
java.lang.IllegalArgumentException
- Description
processDirectory
private void processDirectory(java.io.File directory,
boolean recurse)
throws java.io.IOException
- Processes directory (and its subdirectories), adding file satisfying the
file filter onto the fileList arraylist.
- Parameters:
directory
- The main directory to be processed.recurse
- if true, treat all subdirectories
- Throws:
java.io.IOException
- Description
getFileList
public java.util.ArrayList getFileList()
- Provide the list of File instances with the specified extension in the specified directory
tree.
- Returns:
- The arrayList of all selected files in the tree