net.ultrametrics.io
Class FileTreeTraverser

java.lang.Object
  |
  +--net.ultrametrics.io.FileTreeTraverser

public abstract class FileTreeTraverser
extends java.lang.Object

A class for traversing filesystem trees.

To utilize the tree traversing capabilities:

For every file encountered during the recursive traverse, your class will make a callback to your implementation of process().


Constructor Summary
FileTreeTraverser()
           
 
Method Summary
static void main(java.lang.String[] args)
          Tester.
abstract  void process(java.io.File file)
          Extend this class and implement your custom processing behind this method.
 void traverse(java.io.File f)
           
 void traverse(java.io.File file, boolean doRecurse)
          Traverse a filesystem.
 void traverse(java.io.File file, int depth)
          Traverse a filesystem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTreeTraverser

public FileTreeTraverser()
Method Detail

traverse

public void traverse(java.io.File f)

traverse

public void traverse(java.io.File file,
                     boolean doRecurse)
Traverse a filesystem. If recursion is toggled, recurse into subdirectories, infinitely (..until every node is a file.)
Parameters:
file - the file node to traverse.
doRecurse - whether or not to recurse if the specified file is a directory.

traverse

public void traverse(java.io.File file,
                     int depth)
Traverse a filesystem. Recurse the specified depth into each subdirectory.
Parameters:
file - the file node to traverse.
depth - the maximum depth of recursion allowed.

main

public static void main(java.lang.String[] args)
Tester.

process

public abstract void process(java.io.File file)
Extend this class and implement your custom processing behind this method.
Parameters:
file - the file to process.