JSON
Version 1.0

org.codehaus.jackson.io
Class IOContext

java.lang.Object
  extended by org.codehaus.jackson.io.IOContext

public final class IOContext
extends Object

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
protected  char[] mConcatBuffer
          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  String mEncoding
          Encoding used by the underlying stream, if known.
protected  byte[] mReadIOBuffer
          Reference to the allocated I/O buffer for low-level input reading, if any allocated.
protected  char[] mTokenBuffer
          Reference to the buffer allocated for tokenization purposes, in which character input is read, and from which it can be further returned.
protected  byte[] mWriteIOBuffer
          Reference to the allocated I/O buffer for low-level input writing if any allocated.
 
Constructor Summary
IOContext(BufferRecycler br, Object sourceRef)
           
 
Method Summary
 char[] allocConcatBuffer()
           
 byte[] allocReadIOBuffer()
           Note: the method can only be called once during its life cycle.
 char[] allocTokenBuffer()
           
 byte[] allocWriteIOBuffer()
           
 TextBuffer constructTextBuffer()
           
 String getEncoding()
           
 Object getSourceReference()
           
 void releaseConcatBuffer(char[] buf)
           
 void releaseReadIOBuffer(byte[] buf)
          Method to call when all the processing buffers can be safely recycled.
 void releaseTokenBuffer(char[] buf)
           
 void releaseWriteIOBuffer(byte[] buf)
           
 void setEncoding(String enc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mEncoding

protected String mEncoding
Encoding used by the underlying stream, if known. Will be a Java compatible encoding name (as opposed to, say, xml specification defined encodings), usable as-is with JDK classes.


mReadIOBuffer

protected byte[] mReadIOBuffer
Reference to the allocated I/O buffer for low-level input reading, if any allocated.


mWriteIOBuffer

protected byte[] mWriteIOBuffer
Reference to the allocated I/O buffer for low-level input writing if any allocated.


mTokenBuffer

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


mConcatBuffer

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

Constructor Detail

IOContext

public IOContext(BufferRecycler br,
                 Object sourceRef)
Method Detail

setEncoding

public void setEncoding(String enc)

constructTextBuffer

public TextBuffer constructTextBuffer()

allocReadIOBuffer

public byte[] allocReadIOBuffer()

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


allocWriteIOBuffer

public byte[] allocWriteIOBuffer()

allocTokenBuffer

public char[] allocTokenBuffer()

allocConcatBuffer

public char[] allocConcatBuffer()

releaseReadIOBuffer

public void releaseReadIOBuffer(byte[] buf)
Method to call when all the processing buffers can be safely recycled.


releaseWriteIOBuffer

public void releaseWriteIOBuffer(byte[] buf)

releaseTokenBuffer

public void releaseTokenBuffer(char[] buf)

releaseConcatBuffer

public void releaseConcatBuffer(char[] buf)

getSourceReference

public Object getSourceReference()

getEncoding

public String getEncoding()

JSON
Version 1.0

Apache License, Version 2.0