|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.enterprise.adaptor.prebuilt.RecursiveFileIterator
public class RecursiveFileIterator
Iterate over all files within a folder, including files in subdirectories.
Nested Class Summary | |
---|---|
class |
RecursiveFileIterator.WrappedIOException
Allows throwing IOExceptions and allowing the caller to unpack and rethrow them with certainty. |
Constructor Summary | |
---|---|
RecursiveFileIterator(File rootFile)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RecursiveFileIterator(File rootFile)
rootFile
- directory to recursively list contentsMethod Detail |
---|
public Iterator<File> iterator()
this
to allow using with foreach loops.
iterator
in interface Iterable<File>
public 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |