public interface ObjectStreamBuffer<T>
extends org.mule.runtime.api.streaming.HasSize
It works with the concept of a zero-base position. Each position
represents one byte in the stream. Although this buffer tracks the
position of each byte, it doesn't have a position itself. That means
that pulling data from this buffer does not make any current position
to be moved.
It uses the concept of Bucket to store and return items. Because this buffer needs to provide
random access, array based lists are optimal for obtaining the item in a particular position.
However, expanding the capacity of an array based list is very expensive.
This buffer works by partitioning the items into buckets of array based lists, so that we never need to expand a list, we simply add a new bucket.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases all the resources held by this buffer.
|
Optional<Bucket<T>> |
getBucketFor(Position position)
Returns the
Bucket for the given position |
boolean |
hasNext(long position) |
void |
initialise()
Initialises this buffer.
|
Position |
toPosition(long position)
Transforms the given index based
position to a Position
object |
Optional<Bucket<T>> getBucketFor(Position position)
Bucket for the given positionposition - the bucket's positionPosition toPosition(long position)
position to a Position
objectposition - a zero based index positionPositionboolean hasNext(long position)
position - a position in the streamvoid initialise()
void close()
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.