cds.util
Class DirTree

java.lang.Object
  extended bycds.util.DirTree

public class DirTree
extends java.lang.Object


Field Summary
private  java.io.FileFilter dirFilter
           
private  java.util.ArrayList dirList
           
private  java.io.FileFilter extFilter
           
private  java.util.ArrayList fileList
           
private  java.io.File rootDirectory
           
 
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
 

Field Detail

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
Constructor Detail

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 name
recurse - if true, trat all subdirectories
extensions - An array of extensions, such as ".java"
Throws:
java.io.IOException - Description
java.lang.IllegalArgumentException - Description
Method Detail

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