public abstract class ByteBufferPool
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ByteBufferPool.Set
A set of buffer pools for each size, which can either be
ByteBufferPool.Set.DIRECT or ByteBufferPool.Set.HEAP . |
Modifier and Type | Field and Description |
---|---|
static ByteBufferPool |
LARGE_DIRECT
The large direct buffer pool.
|
static ByteBufferPool |
LARGE_HEAP
The large heap buffer pool.
|
static int |
LARGE_SIZE
The size of large buffers.
|
static ByteBufferPool |
MEDIUM_DIRECT
The medium direct buffer pool.
|
static ByteBufferPool |
MEDIUM_HEAP
The medium heap buffer pool.
|
static int |
MEDIUM_SIZE
The size of medium buffers.
|
static ByteBufferPool |
SMALL_DIRECT
The small direct buffer pool.
|
static ByteBufferPool |
SMALL_HEAP
The small heap buffer pool.
|
static int |
SMALL_SIZE
The size of small buffers.
|
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
allocate()
Allocate a buffer from this source pool.
|
void |
allocate(java.nio.ByteBuffer[] array,
int offs)
Bulk-allocate buffers from this pool.
|
void |
allocate(java.nio.ByteBuffer[] array,
int offs,
int len)
Bulk-allocate buffers from this pool.
|
static void |
free(java.nio.ByteBuffer buffer)
Free a buffer into its appropriate pool based on its size.
|
static void |
free(java.nio.ByteBuffer[] array,
int offs,
int len)
Bulk-free buffers from an array as with
free(ByteBuffer) . |
int |
getSize()
Get the size of buffers returned by this source.
|
boolean |
isDirect()
Determine if this source returns direct buffers.
|
static void |
zeroAndFree(java.nio.ByteBuffer buffer)
Free a buffer as with
free(ByteBuffer) except the buffer is first zeroed and cleared. |
public static final int LARGE_SIZE
public static final int MEDIUM_SIZE
public static final int SMALL_SIZE
public static final ByteBufferPool LARGE_DIRECT
LARGE_SIZE
.public static final ByteBufferPool MEDIUM_DIRECT
MEDIUM_SIZE
.public static final ByteBufferPool SMALL_DIRECT
SMALL_SIZE
.public static final ByteBufferPool LARGE_HEAP
LARGE_SIZE
.public static final ByteBufferPool MEDIUM_HEAP
MEDIUM_SIZE
.public static final ByteBufferPool SMALL_HEAP
SMALL_SIZE
.public java.nio.ByteBuffer allocate()
free(ByteBuffer)
method.public void allocate(java.nio.ByteBuffer[] array, int offs)
free(ByteBuffer)
method.array
- the array of buffers to filloffs
- the offset into the array to fillpublic void allocate(java.nio.ByteBuffer[] array, int offs, int len)
free(ByteBuffer)
method.array
- the array of buffers to filloffs
- the offset into the array to filllen
- the number of buffers to fill in the arraypublic static void free(java.nio.ByteBuffer buffer)
buffer
- the buffer to freepublic static void free(java.nio.ByteBuffer[] array, int offs, int len)
free(ByteBuffer)
. The freed entries will be assigned to
null
.array
- the buffer arrayoffs
- the offset into the arraylen
- the number of buffers to freepublic static void zeroAndFree(java.nio.ByteBuffer buffer)
free(ByteBuffer)
except the buffer is first zeroed and cleared.buffer
- the buffer to freepublic boolean isDirect()
true
if the buffers are direct, false
if they are heappublic int getSize()
Copyright © 2016 JBoss, a division of Red Hat, Inc.