XNIO API 3.0.7.GA

org.xnio
Interface BufferAllocator<B extends Buffer>

Type Parameters:
B - the buffer type

public interface BufferAllocator<B extends Buffer>

A simple allocator for buffers.

Author:
David M. Lloyd

Field Summary
static BufferAllocator<ByteBuffer> BYTE_BUFFER_ALLOCATOR
          A simple allocator for heap-array-backed byte buffers.
static BufferAllocator<ByteBuffer> DIRECT_BYTE_BUFFER_ALLOCATOR
          A simple allocator for direct byte buffers.
 
Method Summary
 B allocate(int size)
          Allocate a buffer of the given size.
 

Field Detail

BYTE_BUFFER_ALLOCATOR

static final BufferAllocator<ByteBuffer> BYTE_BUFFER_ALLOCATOR
A simple allocator for heap-array-backed byte buffers.


DIRECT_BYTE_BUFFER_ALLOCATOR

static final BufferAllocator<ByteBuffer> DIRECT_BYTE_BUFFER_ALLOCATOR
A simple allocator for direct byte buffers.

Method Detail

allocate

B allocate(int size)
                          throws IllegalArgumentException
Allocate a buffer of the given size.

Parameters:
size - the size
Returns:
the buffer
Throws:
IllegalArgumentException - if the given buffer size is less than zero

XNIO API 3.0.7.GA

Copyright © 2010 JBoss, a division of Red Hat, Inc.