com.basho.riak.client.http.response
Class StreamedKeysCollection

java.lang.Object
  extended by com.basho.riak.client.http.util.CollectionWrapper<String>
      extended by com.basho.riak.client.http.response.StreamedKeysCollection
All Implemented Interfaces:
Iterable<String>, Collection<String>

public class StreamedKeysCollection
extends CollectionWrapper<String>

Presents the stream of keys from a Riak bucket response with query parameter keys=stream as a collection. Keys are read from the stream as needed. Note, this class is NOT thread-safe!


Constructor Summary
StreamedKeysCollection(JSONTokener tokens)
           
 
Method Summary
protected  boolean cacheNext()
          Tries to read and cache another set of keys from the input stream.
protected  void closeBackend()
          Close the backend so no more objects can be read from it (getNext() should only return null afterwards).
 
Methods inherited from class com.basho.riak.client.http.util.CollectionWrapper
add, addAll, cache, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

StreamedKeysCollection

public StreamedKeysCollection(JSONTokener tokens)
Method Detail

cacheNext

protected boolean cacheNext()
Tries to read and cache another set of keys from the input stream. This function is actually just a hacked-up implementation that finds the next available array in the stream and sucks elements out of it.

Specified by:
cacheNext in class CollectionWrapper<String>
Returns:
true if an object was added to the cache; false otherwise.

closeBackend

protected void closeBackend()
Description copied from class: CollectionWrapper
Close the backend so no more objects can be read from it (getNext() should only return null afterwards). Called by clear().

Specified by:
closeBackend in class CollectionWrapper<String>


Copyright © 2012. All Rights Reserved.