public class ConsumingIteration extends Object implements CloseableIteration<BindingSet,QueryEvaluationException>
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.| Constructor and Description |
|---|
ConsumingIteration(CloseableIteration<BindingSet,QueryEvaluationException> iter) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this iteration, freeing any resources that it is holding.
|
boolean |
hasNext()
Returns true if the iteration has more elements.
|
BindingSet |
next()
Returns the next element in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned by the iteration (optional operation).
|
public ConsumingIteration(CloseableIteration<BindingSet,QueryEvaluationException> iter) throws QueryEvaluationException
QueryEvaluationExceptionpublic boolean hasNext()
throws QueryEvaluationException
IterationIteration.next()
would return an element rather than throwing a NoSuchElementException.)hasNext in interface Iteration<BindingSet,QueryEvaluationException>QueryEvaluationExceptionpublic BindingSet next() throws QueryEvaluationException
Iterationnext in interface Iteration<BindingSet,QueryEvaluationException>QueryEvaluationExceptionpublic void remove()
throws QueryEvaluationException
Iterationremove in interface Iteration<BindingSet,QueryEvaluationException>QueryEvaluationExceptionpublic void close()
throws QueryEvaluationException
CloseableIterationclose in interface AutoCloseableclose in interface CloseableIteration<BindingSet,QueryEvaluationException>QueryEvaluationExceptionCopyright © 2015-2021 Eclipse Foundation. All Rights Reserved.