-
public interface ReadBufferAllocatorImplementations of this interface can influence howBuffers are allocated that are used when reading from the transport.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description io.netty5.buffer.Bufferallocate(io.netty5.buffer.BufferAllocator allocator, int estimatedCapacity)Allocates aBufferthat is used for the next actual read to store the data in.static ReadBufferAllocatorexact(int numBytes)
-
-
-
Method Detail
-
allocate
io.netty5.buffer.Buffer allocate(io.netty5.buffer.BufferAllocator allocator, int estimatedCapacity)Allocates aBufferthat is used for the next actual read to store the data in.- Parameters:
allocator- TheBufferAllocatorthat might be used for the allocation. While its fine to not use theBufferAllocatorit is important that the returnedBuffermatches theBufferAllocator.getAllocationType()of the allocator.estimatedCapacity- the estimated capacity for the buffer. This is just a best guess and users might decide to use their own capacity.- Returns:
- the
Bufferthat will be used ornullif the read should not happen until the nextChannelOutboundInvoker.read(ReadBufferAllocator)call is done.
-
exact
static ReadBufferAllocator exact(int numBytes)
- Parameters:
numBytes- the number of bytes that can be written.- Returns:
- a
ReadBufferAllocator.
-
-