Package com.isomorphic.datasource
Class StreamingResponseIterator
java.lang.Object
com.isomorphic.base.Base
com.isomorphic.datasource.StreamingResponseIterator
- All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable
,Iterator
For DSRequests that are marked "streamResults: true", the data member of the corresponding DSResponse will be an instance of StreamingResponseIterator. The framework will use this iterator to render results back to the client, or to the various data exporters, on a record-by-record basis, thus avoiding excessive memory overhead when processing large datasets. Your own code can traverse the underlying data, either by calling next() on this object, or by calling the DSResponse's nextRecord() and nextRecordAsObject() APIs. Note that these two approaches may or may not be navigating the same underlying object, and behavior if user code accesses it with both the StreamingResponseIterator and the DSResponse APIs is undefined.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Returns true if this StreamingResponseIterator has more items to return.next()
Returns the next item, or null if there are no more to returnvoid
remove()
This method is part of Iterator's contract, but in this case it no-ops - as a sequential accessor of pre-fetched data, StreamingResponseIterator is obviously read-only
-
Method Details
-
hasNext
public boolean hasNext()Returns true if this StreamingResponseIterator has more items to return.- Returns:
- true if there are more records to stream, otherwise false
-
next
Returns the next item, or null if there are no more to return- Returns:
- the next item
-
remove
public void remove()This method is part of Iterator's contract, but in this case it no-ops - as a sequential accessor of pre-fetched data, StreamingResponseIterator is obviously read-only
-