Modifier and Type | Field and Description |
---|---|
private Iterator | currentIterator
The current directory iterator. |
private Deque | enumStack
This is a stack of current iterators supporting the depth first traversal of the directory tree. |
Access | Constructor and Description |
---|---|
public | DirectoryIterator(File
the root if the directory namespace which is to
be iterated over rootDirectory, boolean if true then the returned entries will be relative
to the rootDirectory and not the current directory. changeInto)Creates a directory iterator. |
Modifier and Type | Method and Description |
---|---|
private List | Returns: a vector containing File objects for each entry in the directory.the directory to be scanned. directory)Get a vector covering all the entries (files and subdirectories in a directory). |
public ClassFile | Returns: the next ClassFile in the iteration.Implements org. |
currentIterator | back to summary |
---|---|
private Iterator<File> currentIterator The current directory iterator. As directories encounter lower level directories, the current iterator is pushed onto the iterator stack and a new iterator over the sub directory becomes the current directory. This implements a depth first traversal of the directory namespace. |
enumStack | back to summary |
---|---|
private Deque<Iterator<File>> enumStack This is a stack of current iterators supporting the depth first traversal of the directory tree. |
DirectoryIterator | back to summary |
---|---|
public DirectoryIterator(File rootDirectory, boolean changeInto) throws IOException Creates a directory iterator. The directory iterator is created to scan the root directory. If the changeInto flag is given, then the entries returned will be relative to this directory and not the current directory.
|
getDirectoryEntries | back to summary |
---|---|
private List Get a vector covering all the entries (files and subdirectories in a directory). |
getNextClassFile | back to summary |
---|---|
public ClassFile getNextClassFile() Implements org. Template method to allow subclasses to supply elements for the iteration. The directory iterator maintains a stack of iterators covering each level in the directory hierarchy. The current iterator covers the current directory being scanned. If the next entry in that directory is a subdirectory, the current iterator is pushed onto the stack and a new iterator is created for the subdirectory. If the entry is a file, it is returned as the next element and the iterator remains valid. If there are no more entries in the current directory, the topmost iterator on the stack is popped off to become the current iterator. |