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 | Method and Description |
---|---|
ByteBuffer |
acquire(int size,
boolean direct)
Requests a
ByteBuffer of the given size. |
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)
Copyright © 1995-2015 Webtide. All Rights Reserved.