Class SimpleBufferAllocator

java.lang.Object
com.google.code.yanf4j.buffer.SimpleBufferAllocator
All Implemented Interfaces:
IoBufferAllocator

public class SimpleBufferAllocator extends Object implements IoBufferAllocator
A simplistic IoBufferAllocator which simply allocates a new buffer every time.
Version:
$Rev: 671827 $, $Date: 2008-06-26 10:49:48 +0200 (Thu, 26 Jun 2008) $
  • Constructor Details

    • SimpleBufferAllocator

      public SimpleBufferAllocator()
  • Method Details

    • allocate

      public IoBuffer allocate(int capacity, boolean direct)
      Description copied from interface: IoBufferAllocator
      Returns the buffer which is capable of the specified size.
      Specified by:
      allocate in interface IoBufferAllocator
      Parameters:
      capacity - the capacity of the buffer
      direct - true to get a direct buffer, false to get a heap buffer.
    • allocateNioBuffer

      public ByteBuffer allocateNioBuffer(int capacity, boolean direct)
      Description copied from interface: IoBufferAllocator
      Returns the NIO buffer which is capable of the specified size.
      Specified by:
      allocateNioBuffer in interface IoBufferAllocator
      Parameters:
      capacity - the capacity of the buffer
      direct - true to get a direct buffer, false to get a heap buffer.
    • wrap

      public IoBuffer wrap(ByteBuffer nioBuffer)
      Description copied from interface: IoBufferAllocator
      Wraps the specified NIO ByteBuffer into MINA buffer.
      Specified by:
      wrap in interface IoBufferAllocator
    • dispose

      public void dispose()
      Description copied from interface: IoBufferAllocator
      Dispose of this allocator.
      Specified by:
      dispose in interface IoBufferAllocator