|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fasterxml.jackson.core.util.BufferRecycler
public class BufferRecycler
This is a small utility class, whose main functionality is to allow
simple reuse of raw byte/char buffers. It is usually used through
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.
| Field Summary | |
|---|---|
protected byte[][] |
_byteBuffers
|
protected char[][] |
_charBuffers
|
static int |
BYTE_BASE64_CODEC_BUFFER
Buffer used for concatenating binary data that is either being encoded as base64 output, or decoded from base64 input. |
static int |
BYTE_READ_IO_BUFFER
Buffer used for reading byte-based input. |
static int |
BYTE_WRITE_CONCAT_BUFFER
Buffer used for temporarily concatenating output; used for example when requesting output as byte array. |
static int |
BYTE_WRITE_ENCODING_BUFFER
Buffer used for temporarily storing encoded content; used for example by UTF-8 encoding writer |
static int |
CHAR_CONCAT_BUFFER
|
static int |
CHAR_NAME_COPY_BUFFER
|
static int |
CHAR_TEXT_BUFFER
|
static int |
CHAR_TOKEN_BUFFER
|
| Constructor Summary | |
|---|---|
|
BufferRecycler()
Default constructor used for creating instances of this default implementation. |
protected |
BufferRecycler(int bbCount,
int cbCount)
Alternate constructor to be used by sub-classes, to allow customization of number of low-level buffers in use. |
| Method Summary | |
|---|---|
byte[] |
allocByteBuffer(int ix)
|
byte[] |
allocByteBuffer(int ix,
int minSize)
|
char[] |
allocCharBuffer(int ix)
|
char[] |
allocCharBuffer(int ix,
int minSize)
|
protected byte[] |
balloc(int size)
|
protected int |
byteBufferLength(int ix)
|
protected char[] |
calloc(int size)
|
protected int |
charBufferLength(int ix)
|
void |
releaseByteBuffer(int ix,
byte[] buffer)
|
void |
releaseCharBuffer(int ix,
char[] buffer)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int BYTE_READ_IO_BUFFER
public static final int BYTE_WRITE_ENCODING_BUFFER
public static final int BYTE_WRITE_CONCAT_BUFFER
public static final int BYTE_BASE64_CODEC_BUFFER
public static final int CHAR_TOKEN_BUFFER
public static final int CHAR_CONCAT_BUFFER
public static final int CHAR_TEXT_BUFFER
public static final int CHAR_NAME_COPY_BUFFER
protected final byte[][] _byteBuffers
protected final char[][] _charBuffers
| Constructor Detail |
|---|
public BufferRecycler()
protected BufferRecycler(int bbCount,
int cbCount)
| Method Detail |
|---|
public final byte[] allocByteBuffer(int ix)
ix - One of READ_IO_BUFFER constants.
public byte[] allocByteBuffer(int ix,
int minSize)
public final void releaseByteBuffer(int ix,
byte[] buffer)
public final char[] allocCharBuffer(int ix)
public char[] allocCharBuffer(int ix,
int minSize)
public void releaseCharBuffer(int ix,
char[] buffer)
protected int byteBufferLength(int ix)
protected int charBufferLength(int ix)
protected byte[] balloc(int size)
protected char[] calloc(int size)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||