public final class

IOContext

extends Object
java.lang.Object
   ↳ com.fasterxml.jackson.core.io.IOContext

Class Overview

To limit number of configuration and state objects to pass, all contextual objects that need to be passed by the factory to readers and writers are combined under this object. One instance is created for each reader and writer.

Summary

Fields
protected byte[] _base64Buffer Reference to the buffer allocated for temporary use with base64 encoding or decoding.
protected final BufferRecycler _bufferRecycler Recycler used for actual allocation/deallocation/reuse
protected char[] _concatCBuffer Reference to the buffer allocated for buffering it for output, before being encoded: generally this means concatenating output, then encoding when buffer fills up.
protected JsonEncoding _encoding Encoding used by the underlying stream, if known.
protected final boolean _managedResource Flag that indicates whether underlying input/output source/target object is fully managed by the owner of this context (parser or generator).
protected char[] _nameCopyBuffer Reference temporary buffer Parser instances need if calling app decides it wants to access name via 'getTextCharacters' method.
protected byte[] _readIOBuffer Reference to the allocated I/O buffer for low-level input reading, if any allocated.
protected final Object _sourceRef Reference to the source object, which can be used for displaying location information
protected char[] _tokenCBuffer Reference to the buffer allocated for tokenization purposes, in which character input is read, and from which it can be further returned.
protected byte[] _writeEncodingBuffer Reference to the allocated I/O buffer used for low-level encoding-related buffering.
Public Constructors
IOContext(BufferRecycler br, Object sourceRef, boolean managedResource)
Public Methods
final byte[] allocBase64Buffer()
final char[] allocConcatBuffer()
final char[] allocNameCopyBuffer(int minSize)
final byte[] allocReadIOBuffer()

Note: the method can only be called once during its life cycle.

final char[] allocTokenBuffer()
final byte[] allocWriteEncodingBuffer()
final TextBuffer constructTextBuffer()
final JsonEncoding getEncoding()
final Object getSourceReference()
final boolean isResourceManaged()
final void releaseBase64Buffer(byte[] buf)
final void releaseConcatBuffer(char[] buf)
final void releaseNameCopyBuffer(char[] buf)
final void releaseReadIOBuffer(byte[] buf)
Method to call when all the processing buffers can be safely recycled.
final void releaseTokenBuffer(char[] buf)
final void releaseWriteEncodingBuffer(byte[] buf)
void setEncoding(JsonEncoding enc)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected byte[] _base64Buffer

Reference to the buffer allocated for temporary use with base64 encoding or decoding.

protected final BufferRecycler _bufferRecycler

Recycler used for actual allocation/deallocation/reuse

protected char[] _concatCBuffer

Reference to the buffer allocated for buffering it for output, before being encoded: generally this means concatenating output, then encoding when buffer fills up.

protected JsonEncoding _encoding

Encoding used by the underlying stream, if known.

protected final boolean _managedResource

Flag that indicates whether underlying input/output source/target object is fully managed by the owner of this context (parser or generator). If true, it is, and is to be closed by parser/generator; if false, calling application has to do closing (unless auto-closing feature is enabled for the parser/generator in question; in which case it acts like the owner).

protected char[] _nameCopyBuffer

Reference temporary buffer Parser instances need if calling app decides it wants to access name via 'getTextCharacters' method. Regular text buffer can not be used as it may contain textual representation of the value token.

protected byte[] _readIOBuffer

Reference to the allocated I/O buffer for low-level input reading, if any allocated.

protected final Object _sourceRef

Reference to the source object, which can be used for displaying location information

protected char[] _tokenCBuffer

Reference to the buffer allocated for tokenization purposes, in which character input is read, and from which it can be further returned.

protected byte[] _writeEncodingBuffer

Reference to the allocated I/O buffer used for low-level encoding-related buffering.

Public Constructors

public IOContext (BufferRecycler br, Object sourceRef, boolean managedResource)

Public Methods

public final byte[] allocBase64Buffer ()

public final char[] allocConcatBuffer ()

public final char[] allocNameCopyBuffer (int minSize)

public final byte[] allocReadIOBuffer ()

Note: the method can only be called once during its life cycle. This is to protect against accidental sharing.

public final char[] allocTokenBuffer ()

public final byte[] allocWriteEncodingBuffer ()

public final TextBuffer constructTextBuffer ()

public final JsonEncoding getEncoding ()

public final Object getSourceReference ()

public final boolean isResourceManaged ()

public final void releaseBase64Buffer (byte[] buf)

public final void releaseConcatBuffer (char[] buf)

public final void releaseNameCopyBuffer (char[] buf)

public final void releaseReadIOBuffer (byte[] buf)

Method to call when all the processing buffers can be safely recycled.

public final void releaseTokenBuffer (char[] buf)

public final void releaseWriteEncodingBuffer (byte[] buf)

public void setEncoding (JsonEncoding enc)