dk.netarkivet.common.utils
Class FileArrayIterator<T>
java.lang.Object
dk.netarkivet.common.utils.FilterIterator<java.io.File,T>
dk.netarkivet.common.utils.FileArrayIterator<T>
- Type Parameters:
T
- The type returned by the FileArrayIterator
- All Implemented Interfaces:
- java.util.Iterator<T>
public abstract class FileArrayIterator<T>
- extends FilterIterator<java.io.File,T>
An iterator that iterates over elements that can be read from files,
given an array of files. It is robust against disappearing files,
but does not try to find new ones that appear while iterating. It
keeps the Iterator contract that next() returns an element if hasNext()
returned true since last next(). This may mean that the underlying
file has disappeared by the time next() is called, but the object is
returned anyway.
Method Summary |
protected T |
filter(java.io.File f)
Returns the T object corresponding to the given file, or null if
that object is to be skipped. |
protected abstract T |
getNext(java.io.File file)
Gives an object created from the given file, or null. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileArrayIterator
protected FileArrayIterator(java.io.File[] files)
filter
protected T filter(java.io.File f)
- Returns the T object corresponding to the given file, or null if
that object is to be skipped.
- Specified by:
filter
in class FilterIterator<java.io.File,T>
- Parameters:
f
- A given file
- Returns:
- An object in the T domain, or null
getNext
protected abstract T getNext(java.io.File file)
- Gives an object created from the given file, or null.
- Parameters:
file
- The file to read
- Returns:
- An object of the type iterated over by the list, or null
if the file does not exist or cannot be used to create an appropriate
object.