Class ByteBufferPool.Sized

java.lang.Object
org.eclipse.jetty.io.ByteBufferPool.Wrapper
org.eclipse.jetty.io.ByteBufferPool.Sized
All Implemented Interfaces:
ByteBufferPool
Enclosing interface:
ByteBufferPool

public static class ByteBufferPool.Sized extends ByteBufferPool.Wrapper
A ByteBufferPool with an additional no-args acquire() method to obtain a buffer of a preconfigured specific size and type.
  • Constructor Details

    • Sized

      public Sized(ByteBufferPool wrapped)
      Create a sized pool for non direct buffers of a default size from a wrapped pool.
      Parameters:
      wrapped - The actual ByteBufferPool
    • Sized

      public Sized(ByteBufferPool wrapped, boolean direct, int size)
      Create a sized pool for a give directness and size from a wrapped pool.
      Parameters:
      wrapped - The actual ByteBufferPool
      direct - true for direct buffers.
      size - The specified size in bytes of the buffer, any value less than 1 means use a default value.
  • Method Details

    • isDirect

      public boolean isDirect()
    • getSize

      public int getSize()
    • acquire

      public RetainableByteBuffer acquire()
      Returns:
      A RetainableByteBuffer suitable for the specified preconfigured size and type.
    • acquire

      public RetainableByteBuffer acquire(int size)
      Parameters:
      size - The specified size in bytes of the buffer
      Returns:
      A RetainableByteBuffer suitable for the specified preconfigured type.
    • acquire

      public RetainableByteBuffer acquire(boolean direct)
      Parameters:
      direct - true for a direct byte buffer, false otherwise
      Returns:
      A RetainableByteBuffer suitable for the specified preconfigured size.