Class ConsumingIteration
- java.lang.Object
-
- org.eclipse.rdf4j.federated.evaluation.iterator.ConsumingIteration
-
- All Implemented Interfaces:
AutoCloseable,Iterator<BindingSet>,CloseableIteration<BindingSet>
public class ConsumingIteration extends Object implements CloseableIteration<BindingSet>
A specializedCloseableIterationthat consumes part (or the entire input iteration if it fits into the buffer) and keeps data for further processing in memory. If the buffer is full, the remaining items will be read from the iteration lazily. This implementation can be used to avoid blocking behavior in HTTP connection streams, i.e. to process results in memory and close the underlying HTTP stream.- Author:
- Andreas Schwarte
-
-
Constructor Summary
Constructors Constructor Description ConsumingIteration(CloseableIteration<BindingSet> iter, int max)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this iteration, freeing any resources that it is holding.booleanhasNext()BindingSetnext()voidremove()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
ConsumingIteration
public ConsumingIteration(CloseableIteration<BindingSet> iter, int max) throws QueryEvaluationException
- Parameters:
iter- iteration to be consumedmax- the number of results to be consumed.- Throws:
QueryEvaluationException
-
-
Method Detail
-
hasNext
public boolean hasNext() throws QueryEvaluationException- Specified by:
hasNextin interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
next
public BindingSet next() throws QueryEvaluationException
- Specified by:
nextin interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
remove
public void remove() throws QueryEvaluationException- Specified by:
removein interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
close
public void close() throws QueryEvaluationExceptionDescription copied from interface:CloseableIterationCloses this iteration, freeing any resources that it is holding. If the iteration has already been closed then invoking this method has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableIteration<BindingSet>- Throws:
QueryEvaluationException
-
-