Modifier and Type | Class and Description |
---|---|
protected class |
DirWalker.DirectoriesOnly
FileFilter that only accepts directories.
|
protected class |
DirWalker.DirIterator
This iterates through the directories.
|
protected class |
DirWalker.DummyFilter
Dummy file filter that accepts all files and directories.
|
protected class |
DirWalker.FilesOnly
FileFilter that only accepts files.
|
class |
DirWalker.Level
This represents a level at a single depth in the tree search.
|
protected class |
DirWalker.LocalIterator
Iterator returning the files in a directory.
|
Modifier and Type | Field and Description |
---|---|
int |
debugLevel
Controls amount of diagnostic listing.
|
protected DirWalker.DirIterator |
directories
Instance of iterator for going through directories.
|
protected FileFilter |
directoriesOnly
Instance of directories only file filter.
|
protected boolean |
done
Set to true when no more items to be returned.
|
protected DirWalker.LocalIterator |
files
Instance of iterator for going through files in directory.
|
protected FileFilter |
filesOnly
Instance of files only file filter.
|
protected FileFilter |
filter
FileFilter to be applied against files before
returning through iterator.
|
protected int |
maxCount
Maximum number of files to be returned.
|
protected File |
root
Root directory of directory structure.
|
Constructor and Description |
---|
DirWalker(File rootValue)
Constructor that results in list of all files that are
children of root directory.
|
DirWalker(File rootValue,
FileFilter filterValue)
Constructor that results in a list that contains all files that
are descendants of the root directory and satisfy the conditions
contained in the file filter.
|
Modifier and Type | Method and Description |
---|---|
int |
getDebugLevel()
Getter for
debugLevel property. |
int |
getMaxCount()
Getter for
maxCount property. |
protected boolean |
hasDirectories(File value)
Indicates if a directory contains subdirectories.
|
protected boolean |
hasFiles(File value)
Indicates whether a directory contains files.
|
boolean |
hasNext()
Indicates whether there are more files in the list.
|
static void |
main(String[] args)
Test driver.
|
File |
next()
Returns next file in list.
|
void |
remove()
This is an optional method that is not implemented for this class.
|
void |
setDebugLevel(int value)
Setter for
debugLevel property. |
void |
setMaxCount(int value)
Setter for
maxCount property. |
void |
test1(File value)
Test program for Level class.
|
Iterator<File> |
test2(File value)
Test iterator for DirWalker class.
|
public int debugLevel
The default value is zero. Higher values result in more information.
protected FileFilter filter
protected boolean done
protected int maxCount
protected FileFilter filesOnly
protected FileFilter directoriesOnly
protected DirWalker.DirIterator directories
protected DirWalker.LocalIterator files
public DirWalker(File rootValue) throws IOException
rootValue
- root directoryIOException
public DirWalker(File rootValue, FileFilter filterValue) throws IOException
rootValue
- root directoryfilterValue
- file filterIOException
public int getDebugLevel()
debugLevel
property.public void setDebugLevel(int value)
debugLevel
property.value
- value for propertypublic int getMaxCount()
maxCount
property.public void setMaxCount(int value)
maxCount
property.value
- value for propertyprotected boolean hasFiles(File value)
value
- directoryprotected boolean hasDirectories(File value)
value
- directorypublic boolean hasNext()
public void remove()
public void test1(File value) throws IOException
value
- root directoryIOException
public Iterator<File> test2(File value) throws IOException
value
- root of directory structureIOException