Interface IoBufferAllocator

All Known Implementing Classes:
CachedBufferAllocator, SimpleBufferAllocator

public interface IoBufferAllocator
Allocates IoBuffers and manages them. Please implement this interface if you need more advanced memory management scheme.
  • Method Summary

    Modifier and Type
    Method
    Description
    allocate(int capacity, boolean direct)
    Returns the buffer which is capable of the specified size.
    allocateNioBuffer(int capacity, boolean direct)
    Returns the NIO buffer which is capable of the specified size.
    void
    Dispose of this allocator.
    wrap(ByteBuffer nioBuffer)
    Wraps the specified NIO ByteBuffer into MINA buffer.
  • Method Details

    • allocate

      IoBuffer allocate(int capacity, boolean direct)
      Returns the buffer which is capable of the specified size.
      Parameters:
      capacity - the capacity of the buffer
      direct - true to get a direct buffer, false to get a heap buffer.
      Returns:
      The allocated IoBuffer
    • allocateNioBuffer

      ByteBuffer allocateNioBuffer(int capacity, boolean direct)
      Returns the NIO buffer which is capable of the specified size.
      Parameters:
      capacity - the capacity of the buffer
      direct - true to get a direct buffer, false to get a heap buffer.
      Returns:
      The allocated ByteBuffer
    • wrap

      IoBuffer wrap(ByteBuffer nioBuffer)
      Wraps the specified NIO ByteBuffer into MINA buffer.
      Parameters:
      nioBuffer - The ByteBuffer to wrap
      Returns:
      The IoBuffer wrapping the ByteBuffer
    • dispose

      void dispose()
      Dispose of this allocator.