public class

BufferRecycler

extends Object
java.lang.Object
   ↳ com.fasterxml.jackson.core.util.BufferRecycler

Class Overview

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.

Summary

Nested Classes
enum BufferRecycler.ByteBufferType  
enum BufferRecycler.CharBufferType  
Constants
int DEFAULT_WRITE_CONCAT_BUFFER_LEN
Fields
protected final byte[][] _byteBuffers
protected final char[][] _charBuffers
Public Constructors
BufferRecycler()
Public Methods
final byte[] allocByteBuffer(BufferRecycler.ByteBufferType type)
final char[] allocCharBuffer(BufferRecycler.CharBufferType type, int minSize)
final char[] allocCharBuffer(BufferRecycler.CharBufferType type)
final void releaseByteBuffer(BufferRecycler.ByteBufferType type, byte[] buffer)
final void releaseCharBuffer(BufferRecycler.CharBufferType type, char[] buffer)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DEFAULT_WRITE_CONCAT_BUFFER_LEN

Constant Value: 2000 (0x000007d0)

Fields

protected final byte[][] _byteBuffers

protected final char[][] _charBuffers

Public Constructors

public BufferRecycler ()

Public Methods

public final byte[] allocByteBuffer (BufferRecycler.ByteBufferType type)

public final char[] allocCharBuffer (BufferRecycler.CharBufferType type, int minSize)

public final char[] allocCharBuffer (BufferRecycler.CharBufferType type)

public final void releaseByteBuffer (BufferRecycler.ByteBufferType type, byte[] buffer)

public final void releaseCharBuffer (BufferRecycler.CharBufferType type, char[] buffer)