public class FilesystemTraverser extends Object
FileConsumer
.FileConsumer
Modifier and Type | Field and Description |
---|---|
private FileConsumer |
consumer |
private FilenameFilter |
filter |
private File |
root |
Constructor and Description |
---|
FilesystemTraverser(File root,
FileConsumer consumer)
Construct a new
FilesystemTraverser . |
FilesystemTraverser(File root,
FilenameFilter filter,
FileConsumer consumer)
Construct a new
FilesystemTraverser . |
Modifier and Type | Method and Description |
---|---|
private boolean |
_traverse(File dir) |
boolean |
traverse()
Traverse the filesystem.
|
private FilenameFilter filter
private FileConsumer consumer
public FilesystemTraverser(File root, FilenameFilter filter, FileConsumer consumer)
FilesystemTraverser
.root
- The root of the directory tree to traverse.consumer
- The FileConsumer
class to pass each
encountered file and directory to.filter
- The FilenameFilter
to filter files through
before passing them to the consumer.public FilesystemTraverser(File root, FileConsumer consumer)
FilesystemTraverser
.root
- The root of the directory tree to traverse.consumer
- The FileConsumer
class to pass each
encountered file and directory to.public boolean traverse()
false
. Each file encountered during the traversal
is passed to the FileConsumer
'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
.FileConsumer.accept(java.io.File)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses