Class LookAheadIterator<E>
- java.lang.Object
-
- org.eclipse.rdf4j.common.iterator.AbstractCloseableIterator<E>
-
- org.eclipse.rdf4j.common.iterator.LookAheadIterator<E>
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.util.Iterator<E>
- Direct Known Subclasses:
UnionIterator
public abstract class LookAheadIterator<E> extends AbstractCloseableIterator<E>
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.IOExceptioncloseExceptionprivate EnextElement
-
Constructor Summary
Constructors Modifier Constructor Description protectedLookAheadIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract EgetNextElement()Gets the next element.protected voidhandleAlreadyClosed()protected voidhandleClose()Called byAbstractCloseableIterator.close()when it is called for the first time.booleanhasNext()private voidlookAhead()Fetches the next element if it hasn't been fetched yet and stores it innextElement.Enext()voidremove()Throws anUnsupportedOperationException.-
Methods inherited from class org.eclipse.rdf4j.common.iterator.AbstractCloseableIterator
close, isClosed
-
-
-
-
Field Detail
-
nextElement
private E nextElement
-
closeException
private java.io.IOException closeException
-
-
Method Detail
-
getNextElement
protected abstract E getNextElement()
Gets the next element. Subclasses should implement this method so that it returns the next element.- Returns:
- The next element, or null if no more elements are available.
-
hasNext
public final boolean hasNext()
-
next
public final E next()
-
lookAhead
private void lookAhead()
Fetches the next element if it hasn't been fetched yet and stores it innextElement.- Throws:
X
-
remove
public void remove()
Throws anUnsupportedOperationException.
-
handleClose
protected void handleClose() throws java.io.IOExceptionDescription copied from class:AbstractCloseableIteratorCalled byAbstractCloseableIterator.close()when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.- Overrides:
handleClosein classAbstractCloseableIterator<E>- Throws:
java.io.IOException
-
handleAlreadyClosed
protected void handleAlreadyClosed() throws java.io.IOException- Overrides:
handleAlreadyClosedin classAbstractCloseableIterator<E>- Throws:
java.io.IOException
-
-