Class SimpleBufferAllocator

  • All Implemented Interfaces:
    IoBufferAllocator

    public class SimpleBufferAllocator
    extends java.lang.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) $
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IoBuffer allocate​(int capacity, boolean direct)
      Returns the buffer which is capable of the specified size.
      java.nio.ByteBuffer allocateNioBuffer​(int capacity, boolean direct)
      Returns the NIO buffer which is capable of the specified size.
      void dispose()
      Dispose of this allocator.
      IoBuffer wrap​(java.nio.ByteBuffer nioBuffer)
      Wraps the specified NIO ByteBuffer into MINA buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleBufferAllocator

        public SimpleBufferAllocator()
    • Method Detail

      • 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 java.nio.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.