class BufferRecycler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private byte[] |
decodingBuffer |
private byte[] |
encodingBuffer |
private short[] |
encodingHash |
private byte[] |
inputBuffer |
private static int |
MIN_ENCODING_BUFFER |
private static int |
MIN_OUTPUT_BUFFER |
private byte[] |
outputBuffer |
protected static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> |
recyclerRef
This
ThreadLocal contains a SoftReference
to a BufferRecycler used to provide a low-cost
buffer recycling for buffers we need for encoding, decoding. |
Constructor and Description |
---|
BufferRecycler() |
Modifier and Type | Method and Description |
---|---|
byte[] |
allocDecodeBuffer(int size) |
byte[] |
allocEncodingBuffer(int minSize) |
short[] |
allocEncodingHash(int suggestedSize) |
byte[] |
allocInputBuffer(int minSize) |
byte[] |
allocOutputBuffer(int minSize) |
void |
clear() |
static BufferRecycler |
instance()
Accessor to get thread-local recycler instance
|
void |
releaseDecodeBuffer(byte[] buffer) |
void |
releaseEncodeBuffer(byte[] buffer) |
void |
releaseEncodingHash(short[] buffer) |
void |
releaseInputBuffer(byte[] buffer) |
void |
releaseOutputBuffer(byte[] buffer) |
private static final int MIN_ENCODING_BUFFER
private static final int MIN_OUTPUT_BUFFER
protected static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> recyclerRef
ThreadLocal
contains a SoftReference
to a BufferRecycler
used to provide a low-cost
buffer recycling for buffers we need for encoding, decoding.private byte[] inputBuffer
private byte[] outputBuffer
private byte[] decodingBuffer
private byte[] encodingBuffer
private short[] encodingHash
public static BufferRecycler instance()
public void clear()
public byte[] allocEncodingBuffer(int minSize)
public void releaseEncodeBuffer(byte[] buffer)
public byte[] allocOutputBuffer(int minSize)
public void releaseOutputBuffer(byte[] buffer)
public short[] allocEncodingHash(int suggestedSize)
public void releaseEncodingHash(short[] buffer)
public byte[] allocInputBuffer(int minSize)
public void releaseInputBuffer(byte[] buffer)
public byte[] allocDecodeBuffer(int size)
public void releaseDecodeBuffer(byte[] buffer)