IoBuffer has been created by Ashish Paliwal (Dec 08, 2008).

Content:

Introduction

Note
This page is being update

A byte buffer used by MINA applications.

This is a replacement for ByteBuffer. MINA does not use NIO ByteBuffer directly for two reasons:

  • It doesn't provide useful getters and putters such as fill, get/putString, and get/putAsciiInt() enough.
  • It is difficult to write variable-length data due to its fixed capacity

Allocation a new IoBuffer

IoBuffer is an abstract class, hence can't be instatiated directly. To allocate IoBuffer, we  need to use allocate() method.

public static IoBuffer allocate(int capacity, boolean direct)

The allocate() method takes two arguments

  • capacity  - the capacity of the buffer
  • direct - type of buffer. true to get direct buffer, false to get heap buffer


The default buffer allocation is handled by SimpleBufferAllocator

Reply via email to