Class ConsumingIteration
java.lang.Object
org.eclipse.rdf4j.federated.evaluation.iterator.ConsumingIteration
- All Implemented Interfaces:
AutoCloseable,Iterator<BindingSet>,CloseableIteration<BindingSet>
A specialized
CloseableIteration that 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 -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
streamMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
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 Details
-
hasNext
- Specified by:
hasNextin interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
next
- Specified by:
nextin interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
remove
- Specified by:
removein interfaceIterator<BindingSet>- Throws:
QueryEvaluationException
-
close
Description 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
-