public final class IOContext extends Object
Modifier and Type | Field and Description |
---|---|
protected 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 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 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.
|
Constructor and Description |
---|
IOContext(BufferRecycler br,
Object sourceRef,
boolean managedResource) |
Modifier and Type | Method and Description |
---|---|
char[] |
allocConcatBuffer() |
char[] |
allocNameCopyBuffer(int minSize) |
byte[] |
allocReadIOBuffer()
Note: the method can only be called once during its life cycle.
|
char[] |
allocTokenBuffer() |
byte[] |
allocWriteEncodingBuffer() |
TextBuffer |
constructTextBuffer() |
JsonEncoding |
getEncoding() |
Object |
getSourceReference() |
boolean |
isResourceManaged() |
void |
releaseConcatBuffer(char[] buf) |
void |
releaseNameCopyBuffer(char[] buf) |
void |
releaseReadIOBuffer(byte[] buf)
Method to call when all the processing buffers can be safely
recycled.
|
void |
releaseTokenBuffer(char[] buf) |
void |
releaseWriteEncodingBuffer(byte[] buf) |
void |
setEncoding(JsonEncoding enc) |
protected final Object _sourceRef
protected JsonEncoding _encoding
protected final boolean _managedResource
protected final BufferRecycler _bufferRecycler
protected byte[] _readIOBuffer
protected byte[] _writeEncodingBuffer
protected char[] _tokenCBuffer
protected char[] _concatCBuffer
protected char[] _nameCopyBuffer
public IOContext(BufferRecycler br, Object sourceRef, boolean managedResource)
public void setEncoding(JsonEncoding enc)
public final Object getSourceReference()
public final JsonEncoding getEncoding()
public final boolean isResourceManaged()
public final TextBuffer constructTextBuffer()
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 byte[] allocWriteEncodingBuffer()
public final char[] allocTokenBuffer()
public final char[] allocConcatBuffer()
public final char[] allocNameCopyBuffer(int minSize)
public final void releaseReadIOBuffer(byte[] buf)
public final void releaseWriteEncodingBuffer(byte[] buf)
public final void releaseTokenBuffer(char[] buf)
public final void releaseConcatBuffer(char[] buf)
public final void releaseNameCopyBuffer(char[] buf)