Class SimpleBufferAllocator

    • 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.
        Returns:
        The allocated IoBuffer
      • 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.
        Returns:
        The allocated ByteBuffer
      • wrap

        public IoBuffer wrap​(java.nio.ByteBuffer nioBuffer)
        Description copied from interface: IoBufferAllocator
        Wraps the specified NIO ByteBuffer into MINA buffer.
        Specified by:
        wrap in interface IoBufferAllocator
        Parameters:
        nioBuffer - The ByteBuffer to wrap
        Returns:
        The IoBuffer wrapping the ByteBuffer