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
QueryEvaluationException
public boolean hasNext() throws QueryEvaluationException
Iteration
Iteration.next()
would return an element rather than throwing a NoSuchElementException.)hasNext
in interface Iteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public BindingSet next() throws QueryEvaluationException
Iteration
next
in interface Iteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public void remove() throws QueryEvaluationException
Iteration
remove
in interface Iteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
public void close() throws QueryEvaluationException
CloseableIteration
close
in interface AutoCloseable
close
in interface CloseableIteration<BindingSet,QueryEvaluationException>
QueryEvaluationException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.