Class SmileGenerator

  • All Implemented Interfaces:
    com.fasterxml.jackson.core.Versioned, java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class SmileGenerator
    extends com.fasterxml.jackson.core.base.GeneratorBase
    JsonGenerator implementation for Smile-encoded content (see Smile Format Specification)
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SmileGenerator.Feature
      Enumeration that defines all togglable features for Smile generators.
      static class  SmileGenerator.SharedStringNode
      Helper class used for keeping track of possibly shareable String references (for field names and/or short String values)
    • Constructor Summary

      Constructors 
      Constructor Description
      SmileGenerator​(com.fasterxml.jackson.core.io.IOContext ioCtxt, int stdFeatures, int smileFeatures, com.fasterxml.jackson.core.ObjectCodec codec, java.io.OutputStream out)  
      SmileGenerator​(com.fasterxml.jackson.core.io.IOContext ioCtxt, int stdFeatures, int smileFeatures, com.fasterxml.jackson.core.ObjectCodec codec, java.io.OutputStream out, byte[] outputBuffer, int offset, boolean bufferRecyclable)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private void _addSeenName​(java.lang.String name)  
      private void _addSeenStringValue​(java.lang.String text)  
      private int _appendReplacementChar​(byte[] outBuf, int outputPtr)  
      private int _decodeAndWriteSurrogate​(int surr1, int surr2, byte[] outBuf, int outputPtr)  
      private void _ensureRoomForOutput​(int needed)  
      private int _findSeenName​(java.lang.String name)  
      private int _findSeenStringValue​(java.lang.String text)  
      protected void _flushBuffer()  
      private int _invalidSurrogateEnd​(int surr1, int surr2, byte[] outBuf, int outputPtr)  
      private int _invalidSurrogateStart​(int code, byte[] outBuf, int outputPtr)  
      private void _mediumUTF8Encode​(char[] str, int inputPtr, int inputEnd)  
      private void _mediumUTF8Encode​(java.lang.String str, int inputPtr, int inputEnd)  
      protected java.lang.UnsupportedOperationException _notSupported()  
      private int _readMore​(java.io.InputStream in, byte[] readBuffer, int inputPtr, int inputEnd, int maxRead)  
      protected void _releaseBuffers()  
      private int _shortUTF8Encode​(char[] str, int i, int end)
      Helper method called when the whole character sequence is known to fit in the output buffer regardless of UTF-8 expansion.
      private int _shortUTF8Encode​(java.lang.String str, int i, int end)  
      private int _shortUTF8Encode2​(char[] str, int i, int end, int outputPtr)
      Helper method called when the whole character sequence is known to fit in the output buffer, but not all characters are single-byte (ASCII) characters.
      private int _shortUTF8Encode2​(java.lang.String str, int i, int end, int outputPtr)  
      private static boolean _validBackRef​(int index)
      Helper method used to ensure that we do not use back-reference values that would produce illegal byte sequences (ones with byte 0xFE or 0xFF).
      protected void _verifyValueWrite​(java.lang.String typeMsg)  
      protected void _write7BitBinaryWithLength​(byte[] data, int offset, int len)  
      protected int _write7BitBinaryWithLength​(java.io.InputStream in, int bytesLeft, byte[] buffer)  
      private void _writeByte​(byte b)  
      private void _writeBytes​(byte[] data, int offset, int len)  
      private void _writeBytes​(byte b1, byte b2)  
      private void _writeBytes​(byte b1, byte b2, byte b3)  
      private void _writeBytes​(byte b1, byte b2, byte b3, byte b4)  
      private void _writeBytes​(byte b1, byte b2, byte b3, byte b4, byte b5)  
      private void _writeBytes​(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6)  
      private int _writeBytes​(java.io.InputStream in, int bytesLeft)  
      private void _writeBytesLong​(byte[] data, int offset, int len)  
      protected void _writeDecimalNumber​(java.lang.String enc)  
      protected void _writeFieldName​(com.fasterxml.jackson.core.SerializableString name)  
      private void _writeFieldName​(java.lang.String name)  
      protected void _writeFieldNameUnicode​(com.fasterxml.jackson.core.SerializableString name, byte[] bytes)  
      protected void _writeIntegralNumber​(java.lang.String enc, boolean neg)  
      private void _writeLongAsciiFieldName​(byte[] bytes)  
      private void _writeNonSharedString​(java.lang.String text, int len)
      Helper method called to handle cases where String value to write is known to be long enough not to be shareable.
      private void _writeNonShortFieldName​(java.lang.String name, int len)  
      private int _writeNumberNoChecks​(int ptr, double d)  
      private int _writeNumberNoChecks​(int ptr, int i)  
      private int _writeNumberNoChecks​(int ptr, long l)  
      private void _writePositiveVInt​(int i)
      Helper method for writing a 32-bit positive (really 31-bit then) value.
      private void _writeSharedNameReference​(int ix)  
      private void _writeSharedStringValueReference​(int ix)  
      private void _writeSignedVInt​(int input)
      Helper method for writing 32-bit signed value, using "zig zag encoding" (see protocol buffers for explanation -- basically, sign bit is moved as LSB, rest of value shifted left by one) coupled with basic variable length encoding
      void assignCurrentValue​(java.lang.Object v)  
      boolean canWriteBinaryNatively()  
      void close()  
      SmileGenerator configure​(SmileGenerator.Feature f, boolean state)  
      java.lang.Object currentValue()  
      SmileGenerator disable​(SmileGenerator.Feature f)  
      SmileGenerator enable​(SmileGenerator.Feature f)  
      void flush()  
      java.lang.Object getCurrentValue()  
      int getFormatFeatures()  
      int getOutputBuffered()  
      com.fasterxml.jackson.core.JsonStreamContext getOutputContext()  
      java.lang.Object getOutputTarget()  
      com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamWriteCapability> getWriteCapabilities()  
      boolean isEnabled​(SmileGenerator.Feature f)  
      protected long outputOffset()
      Method for accessing offset of the next byte within the whole output stream that this generator has produced.
      com.fasterxml.jackson.core.JsonGenerator overrideFormatFeatures​(int values, int mask)  
      void setCurrentValue​(java.lang.Object v)  
      com.fasterxml.jackson.core.JsonGenerator setPrettyPrinter​(com.fasterxml.jackson.core.PrettyPrinter pp)
      No way (or need) to indent anything, so let's block any attempts.
      com.fasterxml.jackson.core.StreamWriteConstraints streamWriteConstraints()  
      com.fasterxml.jackson.core.JsonGenerator useDefaultPrettyPrinter()
      No way (or need) to indent anything, so let's block any attempts.
      com.fasterxml.jackson.core.Version version()  
      void writeArray​(double[] array, int offset, int length)  
      void writeArray​(int[] array, int offset, int length)  
      void writeArray​(long[] array, int offset, int length)  
      void writeBinary​(com.fasterxml.jackson.core.Base64Variant b64variant, byte[] data, int offset, int len)  
      int writeBinary​(com.fasterxml.jackson.core.Base64Variant b64variant, java.io.InputStream data, int dataLength)  
      int writeBinary​(java.io.InputStream data, int dataLength)  
      void writeBoolean​(boolean state)  
      void writeBytes​(byte[] data, int offset, int len)
      Method for directly inserting specified bytes in output at current position.
      void writeEndArray()  
      void writeEndObject()  
      void writeFieldName​(com.fasterxml.jackson.core.SerializableString name)  
      void writeFieldName​(java.lang.String name)  
      void writeHeader()
      Method that can be called to explicitly write Smile document header.
      void writeNull()  
      void writeNumber​(double d)  
      void writeNumber​(float f)  
      void writeNumber​(int i)  
      void writeNumber​(long l)  
      void writeNumber​(java.lang.String encodedValue)  
      void writeNumber​(java.math.BigDecimal dec)  
      void writeNumber​(java.math.BigInteger v)  
      void writeRaw​(byte b)
      Method for directly inserting specified byte in output at current position.
      void writeRaw​(char c)  
      void writeRaw​(char[] text, int offset, int len)  
      void writeRaw​(java.lang.String text)  
      void writeRaw​(java.lang.String text, int offset, int len)  
      void writeRawUTF8String​(byte[] text, int offset, int len)  
      void writeRawValue​(char[] text, int offset, int len)  
      void writeRawValue​(java.lang.String text)  
      void writeRawValue​(java.lang.String text, int offset, int len)  
      void writeStartArray()  
      void writeStartArray​(int size)
      Deprecated.
      void writeStartArray​(java.lang.Object forValue)  
      void writeStartArray​(java.lang.Object forValue, int elementsToWrite)  
      void writeStartObject()  
      void writeStartObject​(java.lang.Object forValue)  
      void writeStartObject​(java.lang.Object forValue, int elementsToWrite)  
      void writeString​(char[] text, int offset, int len)  
      void writeString​(com.fasterxml.jackson.core.SerializableString sstr)  
      void writeString​(java.lang.String text)  
      void writeUTF8String​(byte[] text, int offset, int len)  
      • Methods inherited from class com.fasterxml.jackson.core.base.GeneratorBase

        _asString, _checkRangeBoundsForByteArray, _checkRangeBoundsForCharArray, _checkRangeBoundsForString, _checkStdFeatureChanges, _constructDefaultPrettyPrinter, _decodeSurrogate, disable, enable, getCodec, getFeatureMask, isClosed, isEnabled, overrideStdFeatures, setCodec, setFeatureMask, writeObject, writeRawValue, writeTree
      • Methods inherited from class com.fasterxml.jackson.core.JsonGenerator

        _copyCurrentContents, _copyCurrentFloatValue, _copyCurrentFloatValueExact, _copyCurrentIntValue, _copyCurrentStringValue, _reportError, _reportUnsupportedOperation, _throwInternal, _verifyOffsets, _writeSimpleObject, canOmitFields, canUseSchema, canWriteFormattedNumbers, canWriteObjectId, canWriteTypeId, configure, copyCurrentEvent, copyCurrentEventExact, copyCurrentStructure, getCharacterEscapes, getHighestEscapedChar, getPrettyPrinter, getSchema, isEnabled, setCharacterEscapes, setHighestNonEscapedChar, setRootValueSeparator, setSchema, writeArray, writeArrayFieldStart, writeBinary, writeBinary, writeBinaryField, writeBooleanField, writeEmbeddedObject, writeFieldId, writeNullField, writeNumber, writeNumber, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeObjectField, writeObjectFieldStart, writeObjectId, writeObjectRef, writeOmittedField, writePOJO, writePOJOField, writeRaw, writeString, writeStringField, writeTypeId, writeTypePrefix, writeTypeSuffix
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_NAME_BUFFER_LENGTH

        protected static final int DEFAULT_NAME_BUFFER_LENGTH
        See Also:
        Constant Field Values
      • DEFAULT_STRING_VALUE_BUFFER_LENGTH

        protected static final int DEFAULT_STRING_VALUE_BUFFER_LENGTH
        See Also:
        Constant Field Values
      • MIN_BUFFER_LENGTH

        private static final int MIN_BUFFER_LENGTH
        To simplify certain operations, we require output buffer length to allow outputting of contiguous 256 character UTF-8 encoded String value. Length of the longest UTF-8 code point (from Java char) is 3 bytes, and we need both initial token byte and single-byte end marker so we get following value.

        Note: actually we could live with shorter one; absolute minimum would be for encoding 64-character Strings.

        See Also:
        Constant Field Values
      • TOKEN_BYTE_LONG_STRING_ASCII

        protected static final byte TOKEN_BYTE_LONG_STRING_ASCII
        See Also:
        Constant Field Values
      • TOKEN_BYTE_BIG_INTEGER

        protected static final byte TOKEN_BYTE_BIG_INTEGER
        See Also:
        Constant Field Values
      • TOKEN_BYTE_BIG_DECIMAL

        protected static final byte TOKEN_BYTE_BIG_DECIMAL
        See Also:
        Constant Field Values
      • REPLACEMENT_CHAR

        protected static final int REPLACEMENT_CHAR
        The replacement character to use to fix invalid Unicode sequences (mismatched surrogate pair).
        Since:
        2.13
        See Also:
        Constant Field Values
      • _streamWriteConstraints

        protected final com.fasterxml.jackson.core.StreamWriteConstraints _streamWriteConstraints
        Since:
        2.16
      • _out

        protected final java.io.OutputStream _out
      • _formatFeatures

        protected int _formatFeatures
        Bit flag composed of bits that indicate which SmileGenerator.Features are enabled.
      • _outputBuffer

        protected byte[] _outputBuffer
        Intermediate buffer in which contents are buffered before being written using _out.
      • _outputTail

        protected int _outputTail
        Pointer to the next available byte in _outputBuffer
      • _outputEnd

        protected final int _outputEnd
        Offset to index after the last valid index in _outputBuffer. Typically same as length of the buffer.
      • _bytesWritten

        protected int _bytesWritten
        Let's keep track of how many bytes have been output, may prove useful when debugging. This does not include bytes buffered in the output buffer, just bytes that have been written using underlying stream writer.
      • _seenNames

        protected SmileGenerator.SharedStringNode[] _seenNames
        Raw data structure used for checking whether field name to write can be output using back reference or not.
      • _seenNameCount

        protected int _seenNameCount
        Number of entries in _seenNames; -1 if no shared name detection is enabled
      • _seenStringValues

        protected SmileGenerator.SharedStringNode[] _seenStringValues
        Raw data structure used for checking whether String value to write can be output using back reference or not.
      • _seenStringValueCount

        protected int _seenStringValueCount
        Number of entries in _seenStringValues; -1 if no shared text value detection is enabled
      • _bufferRecyclable

        protected boolean _bufferRecyclable
        Flag that indicates whether the output buffer is recyclable (and needs to be returned to recycler once we are done) or not.
    • Constructor Detail

      • SmileGenerator

        public SmileGenerator​(com.fasterxml.jackson.core.io.IOContext ioCtxt,
                              int stdFeatures,
                              int smileFeatures,
                              com.fasterxml.jackson.core.ObjectCodec codec,
                              java.io.OutputStream out)
        Since:
        2.16
      • SmileGenerator

        public SmileGenerator​(com.fasterxml.jackson.core.io.IOContext ioCtxt,
                              int stdFeatures,
                              int smileFeatures,
                              com.fasterxml.jackson.core.ObjectCodec codec,
                              java.io.OutputStream out,
                              byte[] outputBuffer,
                              int offset,
                              boolean bufferRecyclable)
        Since:
        2.16
    • Method Detail

      • writeHeader

        public void writeHeader()
                         throws java.io.IOException
        Method that can be called to explicitly write Smile document header. Note that usually you do not need to call this for first document to output, but rather only if you intend to write multiple root-level documents with same generator (and even in that case this is optional thing to do). As a result usually only SmileFactory calls this method.
        Throws:
        java.io.IOException
      • version

        public com.fasterxml.jackson.core.Version version()
        Specified by:
        version in interface com.fasterxml.jackson.core.Versioned
        Overrides:
        version in class com.fasterxml.jackson.core.base.GeneratorBase
      • canWriteBinaryNatively

        public boolean canWriteBinaryNatively()
        Overrides:
        canWriteBinaryNatively in class com.fasterxml.jackson.core.JsonGenerator
      • getWriteCapabilities

        public com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamWriteCapability> getWriteCapabilities()
        Overrides:
        getWriteCapabilities in class com.fasterxml.jackson.core.JsonGenerator
      • useDefaultPrettyPrinter

        public com.fasterxml.jackson.core.JsonGenerator useDefaultPrettyPrinter()
        No way (or need) to indent anything, so let's block any attempts. (should we throw an exception instead?)
        Overrides:
        useDefaultPrettyPrinter in class com.fasterxml.jackson.core.base.GeneratorBase
      • setPrettyPrinter

        public com.fasterxml.jackson.core.JsonGenerator setPrettyPrinter​(com.fasterxml.jackson.core.PrettyPrinter pp)
        No way (or need) to indent anything, so let's block any attempts. (should we throw an exception instead?)
        Overrides:
        setPrettyPrinter in class com.fasterxml.jackson.core.JsonGenerator
      • getOutputTarget

        public java.lang.Object getOutputTarget()
        Overrides:
        getOutputTarget in class com.fasterxml.jackson.core.JsonGenerator
      • getOutputBuffered

        public int getOutputBuffered()
        Overrides:
        getOutputBuffered in class com.fasterxml.jackson.core.JsonGenerator
      • getFormatFeatures

        public int getFormatFeatures()
        Overrides:
        getFormatFeatures in class com.fasterxml.jackson.core.JsonGenerator
      • overrideFormatFeatures

        public com.fasterxml.jackson.core.JsonGenerator overrideFormatFeatures​(int values,
                                                                               int mask)
        Overrides:
        overrideFormatFeatures in class com.fasterxml.jackson.core.JsonGenerator
      • currentValue

        public java.lang.Object currentValue()
        Overrides:
        currentValue in class com.fasterxml.jackson.core.JsonGenerator
      • getCurrentValue

        public java.lang.Object getCurrentValue()
        Overrides:
        getCurrentValue in class com.fasterxml.jackson.core.base.GeneratorBase
      • assignCurrentValue

        public void assignCurrentValue​(java.lang.Object v)
        Overrides:
        assignCurrentValue in class com.fasterxml.jackson.core.JsonGenerator
      • setCurrentValue

        public void setCurrentValue​(java.lang.Object v)
        Overrides:
        setCurrentValue in class com.fasterxml.jackson.core.base.GeneratorBase
      • getOutputContext

        public com.fasterxml.jackson.core.JsonStreamContext getOutputContext()
        Overrides:
        getOutputContext in class com.fasterxml.jackson.core.base.GeneratorBase
      • writeFieldName

        public final void writeFieldName​(java.lang.String name)
                                  throws java.io.IOException
        Specified by:
        writeFieldName in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeFieldName

        public final void writeFieldName​(com.fasterxml.jackson.core.SerializableString name)
                                  throws java.io.IOException
        Overrides:
        writeFieldName in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • streamWriteConstraints

        public com.fasterxml.jackson.core.StreamWriteConstraints streamWriteConstraints()
        Overrides:
        streamWriteConstraints in class com.fasterxml.jackson.core.JsonGenerator
      • writeRaw

        public void writeRaw​(byte b)
                      throws java.io.IOException
        Method for directly inserting specified byte in output at current position.

        NOTE: only use this method if you really know what you are doing.

        Throws:
        java.io.IOException
      • writeBytes

        public void writeBytes​(byte[] data,
                               int offset,
                               int len)
                        throws java.io.IOException
        Method for directly inserting specified bytes in output at current position.

        NOTE: only use this method if you really know what you are doing.

        Throws:
        java.io.IOException
      • writeStartArray

        public final void writeStartArray()
                                   throws java.io.IOException
        Specified by:
        writeStartArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeStartArray

        public final void writeStartArray​(java.lang.Object forValue)
                                   throws java.io.IOException
        Overrides:
        writeStartArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeStartArray

        public final void writeStartArray​(java.lang.Object forValue,
                                          int elementsToWrite)
                                   throws java.io.IOException
        Overrides:
        writeStartArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeStartArray

        @Deprecated
        public final void writeStartArray​(int size)
                                   throws java.io.IOException
        Deprecated.
        Overrides:
        writeStartArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeEndArray

        public final void writeEndArray()
                                 throws java.io.IOException
        Specified by:
        writeEndArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeStartObject

        public final void writeStartObject()
                                    throws java.io.IOException
        Specified by:
        writeStartObject in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeStartObject

        public final void writeStartObject​(java.lang.Object forValue)
                                    throws java.io.IOException
        Overrides:
        writeStartObject in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • writeStartObject

        public void writeStartObject​(java.lang.Object forValue,
                                     int elementsToWrite)
                              throws java.io.IOException
        Overrides:
        writeStartObject in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeEndObject

        public final void writeEndObject()
                                  throws java.io.IOException
        Specified by:
        writeEndObject in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeArray

        public void writeArray​(int[] array,
                               int offset,
                               int length)
                        throws java.io.IOException
        Overrides:
        writeArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeArray

        public void writeArray​(long[] array,
                               int offset,
                               int length)
                        throws java.io.IOException
        Overrides:
        writeArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeArray

        public void writeArray​(double[] array,
                               int offset,
                               int length)
                        throws java.io.IOException
        Overrides:
        writeArray in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • _writeFieldName

        private final void _writeFieldName​(java.lang.String name)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeNonShortFieldName

        private final void _writeNonShortFieldName​(java.lang.String name,
                                                   int len)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeFieldName

        protected final void _writeFieldName​(com.fasterxml.jackson.core.SerializableString name)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeLongAsciiFieldName

        private final void _writeLongAsciiFieldName​(byte[] bytes)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeFieldNameUnicode

        protected final void _writeFieldNameUnicode​(com.fasterxml.jackson.core.SerializableString name,
                                                    byte[] bytes)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeSharedNameReference

        private final void _writeSharedNameReference​(int ix)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeString

        public void writeString​(java.lang.String text)
                         throws java.io.IOException
        Specified by:
        writeString in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • _writeSharedStringValueReference

        private final void _writeSharedStringValueReference​(int ix)
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeNonSharedString

        private final void _writeNonSharedString​(java.lang.String text,
                                                 int len)
                                          throws java.io.IOException
        Helper method called to handle cases where String value to write is known to be long enough not to be shareable.
        Throws:
        java.io.IOException
      • writeString

        public void writeString​(char[] text,
                                int offset,
                                int len)
                         throws java.io.IOException
        Specified by:
        writeString in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeString

        public final void writeString​(com.fasterxml.jackson.core.SerializableString sstr)
                               throws java.io.IOException
        Overrides:
        writeString in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • writeRawUTF8String

        public void writeRawUTF8String​(byte[] text,
                                       int offset,
                                       int len)
                                throws java.io.IOException
        Specified by:
        writeRawUTF8String in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeUTF8String

        public final void writeUTF8String​(byte[] text,
                                          int offset,
                                          int len)
                                   throws java.io.IOException
        Specified by:
        writeUTF8String in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeRaw

        public void writeRaw​(java.lang.String text)
                      throws java.io.IOException
        Specified by:
        writeRaw in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeRaw

        public void writeRaw​(java.lang.String text,
                             int offset,
                             int len)
                      throws java.io.IOException
        Specified by:
        writeRaw in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeRaw

        public void writeRaw​(char[] text,
                             int offset,
                             int len)
                      throws java.io.IOException
        Specified by:
        writeRaw in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeRaw

        public void writeRaw​(char c)
                      throws java.io.IOException
        Specified by:
        writeRaw in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeRawValue

        public void writeRawValue​(java.lang.String text)
                           throws java.io.IOException
        Overrides:
        writeRawValue in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • writeRawValue

        public void writeRawValue​(java.lang.String text,
                                  int offset,
                                  int len)
                           throws java.io.IOException
        Overrides:
        writeRawValue in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • writeRawValue

        public void writeRawValue​(char[] text,
                                  int offset,
                                  int len)
                           throws java.io.IOException
        Overrides:
        writeRawValue in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • writeBinary

        public void writeBinary​(com.fasterxml.jackson.core.Base64Variant b64variant,
                                byte[] data,
                                int offset,
                                int len)
                         throws java.io.IOException
        Specified by:
        writeBinary in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeBinary

        public int writeBinary​(java.io.InputStream data,
                               int dataLength)
                        throws java.io.IOException
        Overrides:
        writeBinary in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeBinary

        public int writeBinary​(com.fasterxml.jackson.core.Base64Variant b64variant,
                               java.io.InputStream data,
                               int dataLength)
                        throws java.io.IOException
        Overrides:
        writeBinary in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • writeBoolean

        public void writeBoolean​(boolean state)
                          throws java.io.IOException
        Specified by:
        writeBoolean in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeNull

        public void writeNull()
                       throws java.io.IOException
        Specified by:
        writeNull in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(int i)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • _writeNumberNoChecks

        private final int _writeNumberNoChecks​(int ptr,
                                               int i)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(long l)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • _writeNumberNoChecks

        private final int _writeNumberNoChecks​(int ptr,
                                               long l)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(java.math.BigInteger v)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(double d)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • _writeNumberNoChecks

        private final int _writeNumberNoChecks​(int ptr,
                                               double d)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(float f)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(java.math.BigDecimal dec)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • writeNumber

        public void writeNumber​(java.lang.String encodedValue)
                         throws java.io.IOException
        Specified by:
        writeNumber in class com.fasterxml.jackson.core.JsonGenerator
        Throws:
        java.io.IOException
      • _writeIntegralNumber

        protected void _writeIntegralNumber​(java.lang.String enc,
                                            boolean neg)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeDecimalNumber

        protected void _writeDecimalNumber​(java.lang.String enc)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • _verifyValueWrite

        protected final void _verifyValueWrite​(java.lang.String typeMsg)
                                        throws java.io.IOException
        Specified by:
        _verifyValueWrite in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • flush

        public final void flush()
                         throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class com.fasterxml.jackson.core.base.GeneratorBase
        Throws:
        java.io.IOException
      • _shortUTF8Encode

        private final int _shortUTF8Encode​(char[] str,
                                           int i,
                                           int end)
                                    throws java.io.IOException
        Helper method called when the whole character sequence is known to fit in the output buffer regardless of UTF-8 expansion.
        Throws:
        java.io.IOException
      • _shortUTF8Encode2

        private final int _shortUTF8Encode2​(char[] str,
                                            int i,
                                            int end,
                                            int outputPtr)
                                     throws java.io.IOException
        Helper method called when the whole character sequence is known to fit in the output buffer, but not all characters are single-byte (ASCII) characters.
        Throws:
        java.io.IOException
      • _shortUTF8Encode

        private final int _shortUTF8Encode​(java.lang.String str,
                                           int i,
                                           int end)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • _shortUTF8Encode2

        private final int _shortUTF8Encode2​(java.lang.String str,
                                            int i,
                                            int end,
                                            int outputPtr)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • _mediumUTF8Encode

        private void _mediumUTF8Encode​(char[] str,
                                       int inputPtr,
                                       int inputEnd)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _mediumUTF8Encode

        private void _mediumUTF8Encode​(java.lang.String str,
                                       int inputPtr,
                                       int inputEnd)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _invalidSurrogateStart

        private int _invalidSurrogateStart​(int code,
                                           byte[] outBuf,
                                           int outputPtr)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • _invalidSurrogateEnd

        private int _invalidSurrogateEnd​(int surr1,
                                         int surr2,
                                         byte[] outBuf,
                                         int outputPtr)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • _appendReplacementChar

        private int _appendReplacementChar​(byte[] outBuf,
                                           int outputPtr)
      • _decodeAndWriteSurrogate

        private int _decodeAndWriteSurrogate​(int surr1,
                                             int surr2,
                                             byte[] outBuf,
                                             int outputPtr)
      • _ensureRoomForOutput

        private final void _ensureRoomForOutput​(int needed)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeByte

        private final void _writeByte​(byte b)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final void _writeBytes​(byte b1,
                                       byte b2)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final void _writeBytes​(byte b1,
                                       byte b2,
                                       byte b3)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final void _writeBytes​(byte b1,
                                       byte b2,
                                       byte b3,
                                       byte b4)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final void _writeBytes​(byte b1,
                                       byte b2,
                                       byte b3,
                                       byte b4,
                                       byte b5)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final void _writeBytes​(byte b1,
                                       byte b2,
                                       byte b3,
                                       byte b4,
                                       byte b5,
                                       byte b6)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final void _writeBytes​(byte[] data,
                                       int offset,
                                       int len)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytes

        private final int _writeBytes​(java.io.InputStream in,
                                      int bytesLeft)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • _writeBytesLong

        private final void _writeBytesLong​(byte[] data,
                                           int offset,
                                           int len)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • _writePositiveVInt

        private void _writePositiveVInt​(int i)
                                 throws java.io.IOException
        Helper method for writing a 32-bit positive (really 31-bit then) value. Value is NOT zigzag encoded (since there is no sign bit to worry about)
        Throws:
        java.io.IOException
      • _writeSignedVInt

        private void _writeSignedVInt​(int input)
                               throws java.io.IOException
        Helper method for writing 32-bit signed value, using "zig zag encoding" (see protocol buffers for explanation -- basically, sign bit is moved as LSB, rest of value shifted left by one) coupled with basic variable length encoding
        Throws:
        java.io.IOException
      • _write7BitBinaryWithLength

        protected void _write7BitBinaryWithLength​(byte[] data,
                                                  int offset,
                                                  int len)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • _write7BitBinaryWithLength

        protected int _write7BitBinaryWithLength​(java.io.InputStream in,
                                                 int bytesLeft,
                                                 byte[] buffer)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • _readMore

        private int _readMore​(java.io.InputStream in,
                              byte[] readBuffer,
                              int inputPtr,
                              int inputEnd,
                              int maxRead)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • _releaseBuffers

        protected void _releaseBuffers()
        Specified by:
        _releaseBuffers in class com.fasterxml.jackson.core.base.GeneratorBase
      • _flushBuffer

        protected final void _flushBuffer()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • _findSeenName

        private final int _findSeenName​(java.lang.String name)
      • _addSeenName

        private final void _addSeenName​(java.lang.String name)
      • _findSeenStringValue

        private final int _findSeenStringValue​(java.lang.String text)
      • _addSeenStringValue

        private final void _addSeenStringValue​(java.lang.String text)
      • _validBackRef

        private static final boolean _validBackRef​(int index)
        Helper method used to ensure that we do not use back-reference values that would produce illegal byte sequences (ones with byte 0xFE or 0xFF). Note that we do not try to avoid null byte (0x00) by default, although it would be technically possible as well.
      • outputOffset

        protected long outputOffset()
        Method for accessing offset of the next byte within the whole output stream that this generator has produced.
      • _notSupported

        protected java.lang.UnsupportedOperationException _notSupported()