Modifier and Type | Class and Description |
---|---|
class |
RecursiveFileIterator.WrappedIOException
Allows throwing IOExceptions and allowing the caller to unpack and rethrow
them with certainty.
|
Constructor and Description |
---|
RecursiveFileIterator(File rootFile) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
Iterator<File> |
iterator()
Returns
this to allow using with foreach loops. |
File |
next()
Returns the next file in the iteratior.
|
void |
remove()
Unsupported.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
forEach, spliterator
public RecursiveFileIterator(File rootFile)
rootFile
- directory to recursively list contentspublic boolean hasNext()
true
if the iteration has more elements. Even if this
method throws a WrappedIOException, the iterator can continue to list
files. However, each exception would note a directory that could not be
descended into.hasNext
in interface Iterator<File>
RecursiveFileIterator.WrappedIOException
- if there was an IOExceptionpublic File next()
next
in interface Iterator<File>
RecursiveFileIterator.WrappedIOException
- if there was an IOExceptionpublic void remove()
remove
in interface Iterator<File>
UnsupportedOperationException
- always