- All Implemented Interfaces:
BufferSizePredictor that automatically increases and
decreases the predicted buffer size on feed back.
It gradually increases the expected number of bytes if the previous buffer fully filled the allocated buffer. It gradually decreases the expected number of bytes if the read operation was not able to fill a certain amount of the allocated buffer two times consecutively. Otherwise, it keeps returning the same prediction. TODO: Object type hints could be useful at giving more type-specific predictions
- Trustin Lee, Galder Zamarreño
AdaptiveBufferSizePredictorpublic AdaptiveBufferSizePredictor()Creates a new predictor with the default parameters. With the default parameters, the expected buffer size starts from
512, does not go down below
16, and does not go up above
(int minimum, int initial, int maximum)Creates a new predictor with the specified parameters.
minimum- the inclusive lower bound of the expected buffer size
initial- the initial buffer size when no feed back was received
maximum- the inclusive upper bound of the expected buffer size
nextSizepublic int nextSize
(Object obj)Description copied from interface:
BufferSizePredictorProvide the next buffer size taking in account the object to store in the buffer.
recordSizepublic void recordSize
(int previousSize)Description copied from interface:
BufferSizePredictorRecord the size of the of data in the last buffer used.