Package org.codehaus.commons.compiler.util.iterator

# Class DirectoryIterator

java.lang.Object
org.codehaus.commons.compiler.util.iterator.ProducerIterator<File>
org.codehaus.commons.compiler.util.iterator.DirectoryIterator

All Implemented Interfaces:
  `Iterator<File>`

public class DirectoryIterator extends ProducerIterator<File>
An `Iterator<File>` that finds regular files who's names are `accepted` by the fileNameFilter and

- exist in the given rootDirectory, or
- exist in any subdirectory of the rootDirectory that is `accepted` by the directoryNameFilter.

The returned iterator will throw a `DirectoryIterator.DirectoryNotListableException` when one of the relevant directories cannot be listed.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`DirectoryIterator.DirectoryNotListableException`
Indicates that `File.listFiles()` returned `null` for a particular directory.

## Constructor Summary

Constructors
Constructor
Description
`DirectoryIterator(File rootDirectory, FilenameFilter directoryNameFilter, FilenameFilter fileNameFilter)`

## Method Summary

Modifier and Type
Method
Description
`static Iterator<File>`
`traverseDirectories(File[] rootDirectories, FilenameFilter directoryNameFilter, FilenameFilter fileNameFilter)`
Creates an `Iterator` that returns all matching `File`s locatable in a set of root directories.

### Methods inherited from class org.codehaus.commons.compiler.util.iterator.ProducerIterator

`hasNext, next, remove`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Iterator

`forEachRemaining`

## Constructor Details

### DirectoryIterator

public DirectoryIterator(File rootDirectory, FilenameFilter directoryNameFilter, FilenameFilter fileNameFilter)

## Method Details

### traverseDirectories

public static Iterator<File> traverseDirectories(File[] rootDirectories, FilenameFilter directoryNameFilter, FilenameFilter fileNameFilter)
Creates an `Iterator` that returns all matching `File`s locatable in a set of root directories.

See Also:
  - `DirectoryIterator(File, FilenameFilter, FilenameFilter)`