Interface ByteBufAllocator

All Known Implementing Classes:
AbstractByteBufAllocator, AdaptiveByteBufAllocator, PooledByteBufAllocator, PreferHeapByteBufAllocator, PreferredDirectByteBufAllocator, UnpooledByteBufAllocator

public interface ByteBufAllocator
Implementations are responsible to allocate buffers. Implementations of this interface are expected to be thread-safe.
  • Field Details

  • Method Details

    • buffer

      ByteBuf buffer()
      Allocate a ByteBuf. If it is a direct or heap buffer depends on the actual implementation.
    • buffer

      ByteBuf buffer(int initialCapacity)
      Allocate a ByteBuf with the given initial capacity. If it is a direct or heap buffer depends on the actual implementation.
    • buffer

      ByteBuf buffer(int initialCapacity, int maxCapacity)
      Allocate a ByteBuf with the given initial capacity and the given maximal capacity. If it is a direct or heap buffer depends on the actual implementation.
    • ioBuffer

      ByteBuf ioBuffer()
      Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.
    • ioBuffer

      ByteBuf ioBuffer(int initialCapacity)
      Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.
    • ioBuffer

      ByteBuf ioBuffer(int initialCapacity, int maxCapacity)
      Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.
    • heapBuffer

      ByteBuf heapBuffer()
      Allocate a heap ByteBuf.
    • heapBuffer

      ByteBuf heapBuffer(int initialCapacity)
      Allocate a heap ByteBuf with the given initial capacity.
    • heapBuffer

      ByteBuf heapBuffer(int initialCapacity, int maxCapacity)
      Allocate a heap ByteBuf with the given initial capacity and the given maximal capacity.
    • directBuffer

      ByteBuf directBuffer()
      Allocate a direct ByteBuf.
    • directBuffer

      ByteBuf directBuffer(int initialCapacity)
      Allocate a direct ByteBuf with the given initial capacity.
    • directBuffer

      ByteBuf directBuffer(int initialCapacity, int maxCapacity)
      Allocate a direct ByteBuf with the given initial capacity and the given maximal capacity.
    • compositeBuffer

      CompositeByteBuf compositeBuffer()
      Allocate a CompositeByteBuf. If it is a direct or heap buffer depends on the actual implementation.
    • compositeBuffer

      CompositeByteBuf compositeBuffer(int maxNumComponents)
      Allocate a CompositeByteBuf with the given maximum number of components that can be stored in it. If it is a direct or heap buffer depends on the actual implementation.
    • compositeHeapBuffer

      CompositeByteBuf compositeHeapBuffer()
      Allocate a heap CompositeByteBuf.
    • compositeHeapBuffer

      CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
      Allocate a heap CompositeByteBuf with the given maximum number of components that can be stored in it.
    • compositeDirectBuffer

      CompositeByteBuf compositeDirectBuffer()
      Allocate a direct CompositeByteBuf.
    • compositeDirectBuffer

      CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
      Allocate a direct CompositeByteBuf with the given maximum number of components that can be stored in it.
    • isDirectBufferPooled

      boolean isDirectBufferPooled()
      Returns true if direct ByteBuf's are pooled
    • calculateNewCapacity

      int calculateNewCapacity(int minNewCapacity, int maxCapacity)
      Calculate the new capacity of a ByteBuf that is used when a ByteBuf needs to expand by the minNewCapacity with maxCapacity as upper-bound.