Top Description Fields Methods
org.xnio

public Interface BufferAllocator<B extends Buffer>

Type Parameters
<B>
the buffer type
Imports
java.nio.Buffer, .ByteBuffer

A simple allocator for buffers.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
public static final BufferAllocator<ByteBuffer>
BYTE_BUFFER_ALLOCATOR

A simple allocator for heap-array-backed byte buffers.

public static final BufferAllocator<ByteBuffer>
DIRECT_BYTE_BUFFER_ALLOCATOR

A simple allocator for direct byte buffers.

Method Summary

Modifier and TypeMethod and Description
public B

Returns:

the buffer
allocate
(int
the size
size
)

Allocate a buffer of the given size.

Field Detail

BYTE_BUFFER_ALLOCATORback to summary
public static final BufferAllocator<ByteBuffer> BYTE_BUFFER_ALLOCATOR

A simple allocator for heap-array-backed byte buffers.

DIRECT_BYTE_BUFFER_ALLOCATORback to summary
public static final BufferAllocator<ByteBuffer> DIRECT_BYTE_BUFFER_ALLOCATOR

A simple allocator for direct byte buffers.

Method Detail

allocateback to summary
public B allocate(int size) throws IllegalArgumentException

Allocate a buffer of the given size.

Parameters
size:int

the size

Returns:B

the buffer

Exceptions
IllegalArgumentException:
if the given buffer size is less than zero