org.apache.mina.common
Class SimpleByteBufferAllocator

java.lang.Object
  extended by org.apache.mina.common.SimpleByteBufferAllocator
All Implemented Interfaces:
ByteBufferAllocator

public class SimpleByteBufferAllocator
extends Object
implements ByteBufferAllocator

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

Version:
$Rev: 555855 $, $Date: 2007-07-13 05:19:00 +0200 (Fri, 13 Jul 2007) $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Constructor Summary
SimpleByteBufferAllocator()
           
 
Method Summary
 ByteBuffer allocate(int capacity, boolean direct)
          Returns the buffer which is capable of the specified size.
 void dispose()
          Dispose of this allocator.
 ByteBuffer 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

SimpleByteBufferAllocator

public SimpleByteBufferAllocator()
Method Detail

allocate

public ByteBuffer allocate(int capacity,
                           boolean direct)
Description copied from interface: ByteBufferAllocator
Returns the buffer which is capable of the specified size.

Specified by:
allocate in interface ByteBufferAllocator
Parameters:
capacity - the capacity of the buffer
direct - true to get a direct buffer, false to get a heap buffer.

wrap

public ByteBuffer wrap(ByteBuffer nioBuffer)
Description copied from interface: ByteBufferAllocator
Wraps the specified NIO ByteBuffer into MINA buffer.

Specified by:
wrap in interface ByteBufferAllocator

dispose

public void dispose()
Description copied from interface: ByteBufferAllocator
Dispose of this allocator.

Specified by:
dispose in interface ByteBufferAllocator


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