public class ByteBufferCache
extends java.lang.Object
ByteBuffer
s of specific sizes. This class is not specifically part of constellation, but it may be
useful for applications. This class is thread-safe.Constructor and Description |
---|
ByteBufferCache() |
Modifier and Type | Method and Description |
---|---|
static java.nio.ByteBuffer |
getByteBuffer(int sz,
boolean needsClearing)
Obtains a byte buffer of the specified size.
|
static void |
initializeByteBuffers(int sz,
int count)
Initializes the byte buffer cache with the specified number of buffers of the specified size.
|
static void |
makeAvailableByteBuffer(java.nio.ByteBuffer b)
Make the specified byte buffer available for use, that is, append it to the list of available byte buffers.
|
public static void makeAvailableByteBuffer(java.nio.ByteBuffer b)
b
- the byte buffer to be made available.public static java.nio.ByteBuffer getByteBuffer(int sz, boolean needsClearing)
needsClearing
flag should be set to true
.sz
- size of the byte buffer to be obtained.needsClearing
- whether the buffer must be cleared.public static void initializeByteBuffers(int sz, int count)
sz
- the size of the byte bufferscount
- the number of byte buffers