FinalT
- The final converted type that this class exposes as part of its iterator.ChunkT
- The type of the response chunks, contains an Iterable<CoreT>CoreT
- The raw response type, will get converted to FinalT.public class ChunkedResponseIterator<FinalT,ChunkT extends Iterable<CoreT>,CoreT> extends Object implements Iterator<FinalT>
Iterator
this class will lazily walk
through the response chunks's iterators and convert the items.
It will also wait for more response chunks if none are available.
Since this class polls for new "streaming" data, it is advisable
to check Thread.isInterrupted()
while using this class's
Iterator
in environments where thread interrupts must be obeyed.Modifier and Type | Field and Description |
---|---|
protected Iterator<CoreT> |
currentIterator |
Constructor and Description |
---|
ChunkedResponseIterator(StreamingRiakFuture<ChunkT,?> coreFuture,
int pollTimeout,
Function<CoreT,FinalT> createNextFn,
Function<ChunkT,Iterator<CoreT>> getNextIteratorFn) |
ChunkedResponseIterator(StreamingRiakFuture<ChunkT,?> coreFuture,
int pollTimeout,
Function<CoreT,FinalT> createNextFn,
Function<ChunkT,Iterator<CoreT>> getNextIteratorFn,
Function<ChunkT,BinaryValue> getContinuationFn) |
Modifier and Type | Method and Description |
---|---|
BinaryValue |
getContinuation()
Returns the current value of the continuation.
|
boolean |
hasContinuation()
Returns whether this response contains a continuation.
|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
FinalT |
next()
Returns the next element in the iteration.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, remove
public ChunkedResponseIterator(StreamingRiakFuture<ChunkT,?> coreFuture, int pollTimeout, Function<CoreT,FinalT> createNextFn, Function<ChunkT,Iterator<CoreT>> getNextIteratorFn)
public boolean hasNext()
true
if the iteration has more elements.
(In other words, returns true
if next()
would
return an element rather than throwing an exception.)
This method will block and wait for more data if none is immediately available.
Riak Java Client Note: Since this class polls for
new "streaming" data, it is advisable to check Thread.isInterrupted()
in environments where thread interrupts must be obeyed.public boolean hasContinuation()
public BinaryValue getContinuation()
public FinalT next()
Thread.isInterrupted()
in environments where thread interrupts must be obeyed.next
in interface Iterator<FinalT>
NoSuchElementException
- if the iteration has no more elementsCopyright © 2016. All rights reserved.