Interface ReadBufferAllocator


  • public interface ReadBufferAllocator
    Implementations of this interface can influence how Buffers are allocated that are used when reading from the transport.
    • Method Detail

      • allocate

        io.netty5.buffer.Buffer allocate​(io.netty5.buffer.BufferAllocator allocator,
                                         int estimatedCapacity)
        Allocates a Buffer that is used for the next actual read to store the data in.
        Parameters:
        allocator - The BufferAllocator that might be used for the allocation. While its fine to not use the BufferAllocator it is important that the returned Buffer matches the BufferAllocator.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 Buffer that will be used or null if the read should not happen until the next ChannelOutboundInvoker.read(ReadBufferAllocator) call is done.