public interface ByteBufferPool
A ByteBuffer pool.
Acquired buffers may be released but they do not need to;
if they are released, they may be recycled and reused, otherwise they will be garbage
collected as usual.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ByteBufferPool.Bucket |
static class |
ByteBufferPool.Lease |
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
acquire(int size,
boolean direct)
Requests a
ByteBuffer of the given size. |
default ByteBuffer |
newByteBuffer(int capacity,
boolean direct) |
void |
release(ByteBuffer buffer)
Returns a
ByteBuffer, usually obtained with acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse. |
ByteBuffer acquire(int size, boolean direct)
Requests a ByteBuffer of the given size.
The returned buffer may have a bigger capacity than the size being requested but it will have the limit set to the given size.
size - the size of the bufferdirect - whether the buffer must be direct or notrelease(ByteBuffer)void release(ByteBuffer buffer)
Returns a ByteBuffer, usually obtained with acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse.
buffer - the buffer to returnacquire(int, boolean)default ByteBuffer newByteBuffer(int capacity, boolean direct)
Copyright © 1995–2016 Webtide. All rights reserved.