Class ArchiveReader.ArchiveRecordIterator
java.lang.Object
org.archive.io.ArchiveReader.ArchiveRecordIterator
- All Implemented Interfaces:
Iterator<ArchiveRecord>
- Enclosing class:
ArchiveReader
protected class ArchiveReader.ArchiveRecordIterator
extends Object
implements Iterator<ArchiveRecord>
Inner ArchiveRecord Iterator class.
Throws RuntimeExceptions in
hasNext() and next() if
trouble pulling record from underlying stream.- Version:
- $Date$ $Version$
- Author:
- stack
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ArchiveRecordA next that throws exceptions and has handling of recoverable exceptions moving us to next record.booleanhasNext()protected booleanprotected ArchiveRecordnext()Tries to move to next record if we getRecoverableIOException.voidremove()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ArchiveRecordIterator
protected ArchiveRecordIterator()
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ArchiveRecord>- Returns:
- True if we have more records to read.
- Throws:
RuntimeException- Can throw an IOException wrapped in a RuntimeException if a problem reading underlying stream (Corrupted gzip, etc.).
-
innerHasNext
protected boolean innerHasNext() -
next
Tries to move to next record if we getRecoverableIOException. If notstricttries to move to next record if we get anIOException.- Specified by:
nextin interfaceIterator<ArchiveRecord>- Returns:
- Next object.
- Throws:
RuntimeException- Throws a runtime exception, usually a wrapping of an IOException, if trouble getting a record (Throws exception rather than return null).
-
exceptionNext
A next that throws exceptions and has handling of recoverable exceptions moving us to next record. Can call hasNext which itself may throw exceptions.- Returns:
- Next record.
- Throws:
IOExceptionRuntimeException- Thrown when we've reached maximum retries.
-
innerNext
- Throws:
IOException
-
remove
public void remove()- Specified by:
removein interfaceIterator<ArchiveRecord>
-