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
-
Method Summary
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 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:
hasNext
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
next
- Specified by:
next
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
remove
- Specified by:
remove
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
close
Description copied from interface:CloseableIteration
Closes 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableIteration<BindingSet>
- Throws:
QueryEvaluationException
-