kiwi.io
Class FilesystemTraverser

java.lang.Object
  |
  +--kiwi.io.FilesystemTraverser

public class FilesystemTraverser
extends Object

This class represents a filesystem traverser. A depth-first traversal of a directory tree rooted at a specified node is performed, with each file and directory encountered being passed to a FileAcceptor.

Version:
1.0 (05/98)
Author:
Mark Lindner, PING Software Group
See Also:
FileAcceptor

Constructor Summary
FilesystemTraverser(File root, FileAcceptor acceptor)
          Construct a new FilesystemTraverser.
FilesystemTraverser(File root, FilenameFilter filter, FileAcceptor acceptor)
          Construct a new FilesystemTraverser.
 
Method Summary
 boolean traverse()
          Traverse the filesystem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilesystemTraverser

public FilesystemTraverser(File root,
                           FilenameFilter filter,
                           FileAcceptor acceptor)
Construct a new FilesystemTraverser.
Parameters:
root - The root of the directory tree to traverse.
acceptor - The FileAcceptor class to pass each encountered file and directory to.
filter - The FilenameFilter to filter files through before passing them to the acceptor.

FilesystemTraverser

public FilesystemTraverser(File root,
                           FileAcceptor acceptor)
Construct a new FilesystemTraverser.
Parameters:
root - The root of the directory tree to traverse.
acceptor - The FileAcceptor class to pass each encountered file and directory to.
Method Detail

traverse

public boolean traverse()
Traverse the filesystem. If the root node does not exist or is not a directory, this method returns immediately with a value of false. Each file encountered during the traversal is passed to the FileAcceptor's accept() method; if that method returns false, the traversal is interrupted and this method returns false; otherwise the traversal continues through the end and the method returns true.
See Also:
FileAcceptor.accept(java.io.File)