ArrayByteBufferPool, LeakTrackingByteBufferPool, MappedByteBufferPool, MappedByteBufferPool.Taggedpublic 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 | Description |
|---|---|---|
static class |
ByteBufferPool.Bucket |
|
static class |
ByteBufferPool.Lease |
| Modifier and Type | Method | Description |
|---|---|---|
java.nio.ByteBuffer |
acquire(int size,
boolean direct) |
Requests a
ByteBuffer of the given size. |
default java.nio.ByteBuffer |
newByteBuffer(int capacity,
boolean direct) |
|
void |
release(java.nio.ByteBuffer buffer) |
Returns a
ByteBuffer, usually obtained with acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse. |
java.nio.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(java.nio.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 java.nio.ByteBuffer newByteBuffer(int capacity,
boolean direct)
Copyright © 1995–2017 Webtide. All rights reserved.