Package org.codehaus.jackson.io
Class IOContext
java.lang.Object
org.codehaus.jackson.io.IOContext
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BufferRecycler
Recycler used for actual allocation/deallocation/reuseprotected char[]
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 used by the underlying stream, if known.protected final boolean
Flag that indicates whether underlying input/output source/target object is fully managed by the owner of this context (parser or generator).protected char[]
Reference temporary buffer Parser instances need if calling app decides it wants to access name via 'getTextCharacters' method.protected byte[]
Reference to the allocated I/O buffer for low-level input reading, if any allocated.protected final Object
Reference to the source object, which can be used for displaying location informationprotected char[]
Reference to the buffer allocated for tokenization purposes, in which character input is read, and from which it can be further returned.protected byte[]
Reference to the allocated I/O buffer used for low-level encoding-related buffering. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal char[]
final char[]
allocNameCopyBuffer
(int minSize) final byte[]
Note: the method can only be called once during its life cycle.final char[]
final byte[]
final TextBuffer
final JsonEncoding
final Object
final boolean
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)
-
Field Details
-
_sourceRef
Reference to the source object, which can be used for displaying location information -
_encoding
Encoding used by the underlying stream, if known. -
_managedResource
protected final boolean _managedResourceFlag 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). -
_bufferRecycler
Recycler used for actual allocation/deallocation/reuse -
_readIOBuffer
protected byte[] _readIOBufferReference to the allocated I/O buffer for low-level input reading, if any allocated. -
_writeEncodingBuffer
protected byte[] _writeEncodingBufferReference to the allocated I/O buffer used for low-level encoding-related buffering. -
_tokenCBuffer
protected char[] _tokenCBufferReference to the buffer allocated for tokenization purposes, in which character input is read, and from which it can be further returned. -
_concatCBuffer
protected char[] _concatCBufferReference to the buffer allocated for buffering it for output, before being encoded: generally this means concatenating output, then encoding when buffer fills up. -
_nameCopyBuffer
protected char[] _nameCopyBufferReference 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.
-
-
Constructor Details
-
IOContext
-
-
Method Details
-
setEncoding
-
getSourceReference
-
getEncoding
-
isResourceManaged
public final boolean isResourceManaged() -
constructTextBuffer
-
allocReadIOBuffer
public final byte[] allocReadIOBuffer()Note: the method can only be called once during its life cycle. This is to protect against accidental sharing.
-
allocWriteEncodingBuffer
public final byte[] allocWriteEncodingBuffer() -
allocTokenBuffer
public final char[] allocTokenBuffer() -
allocConcatBuffer
public final char[] allocConcatBuffer() -
allocNameCopyBuffer
public final char[] allocNameCopyBuffer(int minSize) -
releaseReadIOBuffer
public final void releaseReadIOBuffer(byte[] buf) Method to call when all the processing buffers can be safely recycled. -
releaseWriteEncodingBuffer
public final void releaseWriteEncodingBuffer(byte[] buf) -
releaseTokenBuffer
public final void releaseTokenBuffer(char[] buf) -
releaseConcatBuffer
public final void releaseConcatBuffer(char[] buf) -
releaseNameCopyBuffer
public final void releaseNameCopyBuffer(char[] buf)
-