private static final class AdaptiveRecvByteBufAllocator.HandleImpl extends java.lang.Object implements RecvByteBufAllocator.Handle
Modifier and Type | Field and Description |
---|---|
private boolean |
decreaseNow |
private int |
index |
private int |
maxIndex |
private int |
minIndex |
private int |
nextReceiveBufferSize |
Constructor and Description |
---|
HandleImpl(int minIndex,
int maxIndex,
int initial) |
Modifier and Type | Method and Description |
---|---|
ByteBuf |
allocate(ByteBufAllocator alloc)
Creates a new receive buffer whose capacity is probably large enough to read all inbound data and small
enough not to waste its space.
|
int |
guess()
Similar to
RecvByteBufAllocator.Handle.allocate(ByteBufAllocator) except that it does not allocate anything but just tells the
capacity. |
void |
record(int actualReadBytes)
Records the the actual number of read bytes in the previous read operation so that the allocator allocates
the buffer with potentially more correct capacity.
|
private final int minIndex
private final int maxIndex
private int index
private int nextReceiveBufferSize
private boolean decreaseNow
public ByteBuf allocate(ByteBufAllocator alloc)
RecvByteBufAllocator.Handle
allocate
in interface RecvByteBufAllocator.Handle
public int guess()
RecvByteBufAllocator.Handle
RecvByteBufAllocator.Handle.allocate(ByteBufAllocator)
except that it does not allocate anything but just tells the
capacity.guess
in interface RecvByteBufAllocator.Handle
public void record(int actualReadBytes)
RecvByteBufAllocator.Handle
record
in interface RecvByteBufAllocator.Handle
actualReadBytes
- the actual number of read bytes in the previous read operation