public interface DirectoryItemHandler
DirectoryItemHandler
interface defines a single
method, handleItem
, which is used to perform some
operation on the items within an entire directory tree in the local
filesystem. DirectoryTree.traverse
calls the
handleItem
method for every item in the tree,
allowing clients who implement this interface to provide different
applications for directory traversals, such as listing files,
renaming items, copying files, etc.Modifier and Type | Method and Description |
---|---|
boolean |
handleItem(File file,
int howDeep)
Performs some operation on the current File in
a directory tree traversal in the local filesystem.
|
boolean handleItem(File file, int howDeep) throws Exception
DirectoryTree.traverse
.file
- the current File being handled by
DirectoryTree.traverse
.howDeep
- how "deep" the traversal is in the tree, with
respect to the root folder in the local
filesystem. (i.e., if the current file is:
/foo/bar/a/b/x.txt
and the root of the
traversal was specified as /foo/bar
,
then howDeep == 2
.)Exception
- if anything goes wrong while handling the
item. Clients who implement this interface
should throw whatever specific subclass of
Exception is necessary from their implementation
of this method.Copyright © 2023. All rights reserved.