public final class BufferRecycler extends Object
Modifier and Type | Field and Description |
---|---|
protected static ThreadLocal<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) |
int[] |
allocEncodingHash(int suggestedSize) |
byte[] |
allocInputBuffer(int minSize) |
byte[] |
allocOutputBuffer(int minSize) |
static BufferRecycler |
instance()
Accessor to get thread-local recycler instance
|
void |
releaseDecodeBuffer(byte[] buffer) |
void |
releaseEncodeBuffer(byte[] buffer) |
void |
releaseEncodingHash(int[] buffer) |
void |
releaseInputBuffer(byte[] buffer) |
void |
releaseOutputBuffer(byte[] buffer) |
protected static final ThreadLocal<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.public static BufferRecycler instance()
public byte[] allocEncodingBuffer(int minSize)
public void releaseEncodeBuffer(byte[] buffer)
public byte[] allocOutputBuffer(int minSize)
public void releaseOutputBuffer(byte[] buffer)
public int[] allocEncodingHash(int suggestedSize)
public void releaseEncodingHash(int[] buffer)
public byte[] allocInputBuffer(int minSize)
public void releaseInputBuffer(byte[] buffer)
public byte[] allocDecodeBuffer(int size)
public void releaseDecodeBuffer(byte[] buffer)
Copyright © 2016. All rights reserved.