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 specializedCloseableIteration
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 Constructor Description ConsumingIteration(CloseableIteration<BindingSet> iter, int max)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this iteration, freeing any resources that it is holding.boolean
hasNext()
BindingSet
next()
void
remove()
-
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:
hasNext
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
next
public BindingSet next() throws QueryEvaluationException
- Specified by:
next
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
remove
public void remove() throws QueryEvaluationException
- Specified by:
remove
in interfaceIterator<BindingSet>
- Throws:
QueryEvaluationException
-
close
public void close() throws QueryEvaluationException
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
-
-