org.apache.mina.core.buffer

## Interface IoBufferAllocator

- All Known Implementing Classes:
    CachedBufferAllocator, SimpleBufferAllocator

      public interface IoBufferAllocator

  Allocates `IoBuffer`s and manages them. Please implement this interface if you need more advanced memory management scheme.
  Author:
    Apache MINA Project

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.

- - ### Method Detail

    - #### allocate

          IoBuffer allocate(int capacity,
                          boolean direct)

      Returns the buffer which is capable of the specified size.
      Parameters:
        `capacity` - the capacity of the buffer
        `direct` - `true` to get a direct buffer, `false` to get a heap buffer.

    - #### allocateNioBuffer

          ByteBuffer allocateNioBuffer(int capacity,
                                     boolean direct)

      Returns the NIO buffer which is capable of the specified size.
      Parameters:
        `capacity` - the capacity of the buffer
        `direct` - `true` to get a direct buffer, `false` to get a heap buffer.

    - #### wrap

          IoBuffer wrap(ByteBuffer nioBuffer)

      Wraps the specified NIO `ByteBuffer` into MINA buffer.

    - #### dispose

          void dispose()

      Dispose of this allocator.

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