Class 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) $
    Author:
    The Apache MINA Project (dev@mina.apache.org)
    • 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 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.