public interface ChunkDataStream
This avoid loading all chunks into memory at once, reducing the memory footprint and persistence operations.
The chunks are loaded individually in sequence. Strong references to
the chunks represented by DataContainer
s should be avoided
AT ALL COSTS. The data represented is a copy and
therefore shouldn't be considered synchronized to live data.
This is a data stream from the chunk storage system and should be used in an asynchronous thread from the main thread.
Modifier and Type | Method and Description |
---|---|
int |
available()
Gets the number of chunks available to read as
DataContainer s. |
boolean |
hasNext()
Checks if there is an available chunk to represent.
|
DataContainer |
next()
Gets the next
Chunk represented by a read only DataContainer . |
void |
reset()
Resets this stream to read from the beginning of the collection of
chunks.
|
@Nullable DataContainer next()
Chunk
represented by a read only DataContainer
.
This method BLOCKS the thread until the next available data has been read.
This may not return a DataContainer
in the event there is no
chunk data available to read.
boolean hasNext()
int available()
DataContainer
s.void reset()