public class DirectoryTree extends Object
DirectoryTree
traverses a
directory tree in the local filesystem. It calls the
handleItem
method on the given
DirectoryItemHandler
for every file
in the directory tree.Constructor and Description |
---|
DirectoryTree() |
Modifier and Type | Method and Description |
---|---|
static void |
traverse(File dir,
boolean recurse,
DirectoryItemHandler strategy)
Traverses a directory tree in the local filesystem.
|
static void |
traverseDepthFirst(File dir,
DirectoryItemHandler strategy)
Traverses a directory tree in the local filesystem.
|
public static void traverse(File dir, boolean recurse, DirectoryItemHandler strategy) throws DirectoryItemHandlerException
dir
- the root directory at which to begin the traversal.recurse
- whether or not to recurse through every subdirectory
within the root directory.strategy
- the DirectoryItemHandler
to use for
handling each item in the tree.DirectoryItemHandlerException
- if an error occurs while
handling the items in the directory.public static void traverseDepthFirst(File dir, DirectoryItemHandler strategy) throws DirectoryItemHandlerException
dir
- the root directory at which to begin the traversal.strategy
- the DirectoryItemHandler
to use for
handling each item in the tree.DirectoryItemHandlerException
- if an error occurs while
handling the items in the directory.Copyright © 2023. All rights reserved.