public class BufferRecycler
extends java.lang.Object
ThreadLocal
member of the owning class pointing to
instance of this class through a SoftReference
. The
end result is a low-overhead GC-cleanable recycling: hopefully
ideal for use by stream readers.Modifier and Type | Class | Description |
---|---|---|
static class |
BufferRecycler.ByteBufferType |
|
static class |
BufferRecycler.CharBufferType |
Modifier and Type | Field | Description |
---|---|---|
protected byte[][] |
_byteBuffers |
|
protected char[][] |
_charBuffers |
|
static int |
DEFAULT_WRITE_CONCAT_BUFFER_LEN |
Constructor | Description |
---|---|
BufferRecycler() |
Modifier and Type | Method | Description |
---|---|---|
byte[] |
allocByteBuffer(BufferRecycler.ByteBufferType type) |
|
char[] |
allocCharBuffer(BufferRecycler.CharBufferType type) |
|
char[] |
allocCharBuffer(BufferRecycler.CharBufferType type,
int minSize) |
|
void |
releaseByteBuffer(BufferRecycler.ByteBufferType type,
byte[] buffer) |
|
void |
releaseCharBuffer(BufferRecycler.CharBufferType type,
char[] buffer) |
public static final int DEFAULT_WRITE_CONCAT_BUFFER_LEN
protected final byte[][] _byteBuffers
protected final char[][] _charBuffers
public final byte[] allocByteBuffer(BufferRecycler.ByteBufferType type)
public final void releaseByteBuffer(BufferRecycler.ByteBufferType type, byte[] buffer)
public final char[] allocCharBuffer(BufferRecycler.CharBufferType type)
public final char[] allocCharBuffer(BufferRecycler.CharBufferType type, int minSize)
public final void releaseCharBuffer(BufferRecycler.CharBufferType type, char[] buffer)