org.apache.mina.core.buffer
Class SimpleBufferAllocator

java.lang.Object
  extended by org.apache.mina.core.buffer.SimpleBufferAllocator
All Implemented Interfaces:
IoBufferAllocator

public class SimpleBufferAllocator
extends Object
implements IoBufferAllocator

A simplistic IoBufferAllocator which simply allocates a new buffer every time.

Author:
Apache MINA Project

Constructor Summary
SimpleBufferAllocator()
           
 
Method Summary
 IoBuffer allocate(int capacity, boolean direct)
          Returns the buffer which is capable of the specified size.
 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(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 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


Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.