org.codehaus.jackson.util
Class BufferRecycler
java.lang.Object
org.codehaus.jackson.util.BufferRecycler
public final class BufferRecycler
- extends Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mByteBuffers
protected final byte[][] mByteBuffers
mCharBuffers
protected final char[][] mCharBuffers
BufferRecycler
public BufferRecycler()
allocByteBuffer
public byte[] allocByteBuffer(BufferRecycler.ByteBufferType type)
releaseByteBuffer
public void releaseByteBuffer(BufferRecycler.ByteBufferType type,
byte[] buffer)
allocCharBuffer
public char[] allocCharBuffer(BufferRecycler.CharBufferType type)
allocCharBuffer
public char[] allocCharBuffer(BufferRecycler.CharBufferType type,
int minSize)
releaseCharBuffer
public void releaseCharBuffer(BufferRecycler.CharBufferType type,
char[] buffer)
Apache License, Version 2.0