All Implemented Interfaces:
public final class
This is a simple ByteBufferPool which just creates ByteBuffers as needed.
It also caches ByteBuffers after they're released. It will always return
the smallest cached buffer with at least the capacity you request.
We don't try to do anything clever here like try to limit the maximum cache
Modifier and Type
Method and Description
int length) getBuffer
Get a new direct ByteBuffer.
( putBuffer ByteBuffer buffer)
Release a buffer back to the pool.
Methods inherited from class java.lang.
Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
ByteBuffer getBuffer(boolean direct,
Get a new direct ByteBuffer. The pool can provide this from
removing a buffer from its internal cache, or by allocating a
getBuffer ByteBufferPool Parameters:
direct - Whether the buffer should be direct.
length - The minimum length the buffer will have.
Returns: A new ByteBuffer. This ByteBuffer must be direct.
Its capacity can be less than what was requested, but
must be at least 1 byte.
Copyright © 2016 Apache Software Foundation. All Rights Reserved.