Class IOContext


  • public 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.

    NOTE: non-final since 2.4, to allow sub-classing.

    • Constructor Detail

    • Method Detail

      • setEncoding

        public void setEncoding​(JsonEncoding enc)
      • getSourceReference

        public Object getSourceReference()
      • isResourceManaged

        public boolean isResourceManaged()
      • constructTextBuffer

        public TextBuffer constructTextBuffer()
      • allocReadIOBuffer

        public byte[] allocReadIOBuffer()
        Method for recycling or allocation byte buffer of "read I/O" type.

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

        Returns:
        Allocated or recycled byte buffer
      • allocReadIOBuffer

        public byte[] allocReadIOBuffer​(int minSize)
        Variant of allocReadIOBuffer() that specifies smallest acceptable buffer size.
        Parameters:
        minSize - Minimum size of the buffer to recycle or allocate
        Returns:
        Allocated or recycled byte buffer
        Since:
        2.4
      • allocWriteEncodingBuffer

        public byte[] allocWriteEncodingBuffer()
        Method for recycling or allocation byte buffer of "write encoding" type.

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

        Returns:
        Allocated or recycled byte buffer
      • allocWriteEncodingBuffer

        public byte[] allocWriteEncodingBuffer​(int minSize)
        Variant of allocWriteEncodingBuffer() that specifies smallest acceptable buffer size.
        Parameters:
        minSize - Minimum size of the buffer to recycle or allocate
        Returns:
        Allocated or recycled byte buffer
        Since:
        2.4
      • allocBase64Buffer

        public byte[] allocBase64Buffer()
        Method for recycling or allocation byte buffer of "base 64 encode/decode" type.

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

        Returns:
        Allocated or recycled byte buffer
      • allocBase64Buffer

        public byte[] allocBase64Buffer​(int minSize)
        Variant of allocBase64Buffer() that specifies smallest acceptable buffer size.
        Parameters:
        minSize - Minimum size of the buffer to recycle or allocate
        Returns:
        Allocated or recycled byte buffer
        Since:
        2.9
      • allocTokenBuffer

        public char[] allocTokenBuffer()
      • allocTokenBuffer

        public char[] allocTokenBuffer​(int minSize)
      • allocConcatBuffer

        public char[] allocConcatBuffer()
      • allocNameCopyBuffer

        public char[] allocNameCopyBuffer​(int minSize)
      • releaseReadIOBuffer

        public void releaseReadIOBuffer​(byte[] buf)
        Method to call when all the processing buffers can be safely recycled.
        Parameters:
        buf - Buffer instance to release (return for recycling)
      • releaseWriteEncodingBuffer

        public void releaseWriteEncodingBuffer​(byte[] buf)
      • releaseBase64Buffer

        public void releaseBase64Buffer​(byte[] buf)
      • releaseTokenBuffer

        public void releaseTokenBuffer​(char[] buf)
      • releaseConcatBuffer

        public void releaseConcatBuffer​(char[] buf)
      • releaseNameCopyBuffer

        public void releaseNameCopyBuffer​(char[] buf)