util
Class FileTree

java.lang.Object
  extended by util.FileTree

public class FileTree
extends Object

A class generating a file tree from a root directory. If a filenamefilter is specifeid it is passed along with the root dir.


Nested Class Summary
static class FileTree.NameFilter
          A file filter that accepts file names and extensions.
 
Field Summary
private static HashSet<File> list
          A set of all non-directories found in the tree.
 
Constructor Summary
FileTree()
           
 
Method Summary
static File[] getArray(File rootdir)
          Returns a file list of all files in the given rootdir and below.
static File[] getArray(File rootdir, FileFilter filter)
          Returns a file list of all files in the given rootdir and below.
static Collection<File> getList(File rootdir)
          Returns a file list of all files in the given rootdir and below.
static Collection<File> getList(File rootdir, FileFilter filter)
          Returns a file list of all files in the given rootdir and below following the file filter's accept method.
static void main(String[] arg)
          Test purpose mainly.
private static void parse(File root, FileFilter filter, int level)
          Recursevly parse this dir and its subdirs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

private static HashSet<File> list
A set of all non-directories found in the tree.

Constructor Detail

FileTree

public FileTree()
Method Detail

getList

public static Collection<File> getList(File rootdir)
Returns a file list of all files in the given rootdir and below.


getList

public static Collection<File> getList(File rootdir,
                                       FileFilter filter)
Returns a file list of all files in the given rootdir and below following the file filter's accept method.


getArray

public static File[] getArray(File rootdir)
Returns a file list of all files in the given rootdir and below.


getArray

public static File[] getArray(File rootdir,
                              FileFilter filter)
Returns a file list of all files in the given rootdir and below.


parse

private static final void parse(File root,
                                FileFilter filter,
                                int level)
Recursevly parse this dir and its subdirs. Push all non-directories into the class variable list. If a file filter is given, only files matching that filter are considered. Please be aware that the filter accepts all directory entries otherwise parsing into subdirs is not possible.


main

public static void main(String[] arg)
Test purpose mainly.