Class SmileGenerator

java.lang.Object
tools.jackson.core.JsonGenerator
tools.jackson.core.base.GeneratorBase
tools.jackson.dataformat.smile.SmileGenerator
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, tools.jackson.core.Versioned

public class SmileGenerator extends tools.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 final class 
    Helper class used for keeping track of possibly shareable String references (for property names and/or short String values)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Flag that indicates whether the output buffer is recyclable (and needs to be returned to recycler once we are done) or not.
    protected int
    Let's keep track of how many bytes have been output, may prove useful when debugging.
    protected int
    Bit flag composed of bits that indicate which SmileWriteFeatures are enabled.
    protected final OutputStream
     
    protected byte[]
    Intermediate buffer in which contents are buffered before being written using _out.
    protected final int
    Offset to index after the last valid index in _outputBuffer.
    protected int
    Pointer to the next available byte in _outputBuffer
    protected int
    Number of entries in _seenNames; -1 if no shared name detection is enabled
    Raw data structure used for checking whether property name to write can be output using back reference or not.
    protected int
    Number of entries in _seenStringValues; -1 if no shared text value detection is enabled
    Raw data structure used for checking whether String value to write can be output using back reference or not.
    protected tools.jackson.core.util.SimpleStreamWriteContext
    Object that keeps track of the current contextual state of the generator.
    protected static final int
     
    protected static final int
     
    protected static final long
     
    private static final int
    To simplify certain operations, we require output buffer length to allow outputting of contiguous 256 character UTF-8 encoded String value.
    protected static final long
     
    protected static final int
    The replacement character to use to fix invalid Unicode sequences (mismatched surrogate pair).
    protected static final byte
     
    protected static final byte
     
    protected static final byte
     
    protected static final byte
     
    protected static final byte
     
    protected static final byte
     
    protected static final byte
     

    Fields inherited from class tools.jackson.core.base.GeneratorBase

    _closed, _ioContext, _objectWriteContext, _streamWriteConstraints, _streamWriteFeatures, DEFAULT_BINARY_WRITE_CAPABILITIES, DEFAULT_TEXTUAL_WRITE_CAPABILITIES, DEFAULT_WRITE_CAPABILITIES, MAX_BIG_DECIMAL_SCALE, SURR1_FIRST, SURR1_LAST, SURR2_FIRST, SURR2_LAST, WRITE_BINARY, WRITE_BOOLEAN, WRITE_NULL, WRITE_NUMBER, WRITE_RAW, WRITE_STRING
  • Constructor Summary

    Constructors
    Constructor
    Description
    SmileGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, int streamWriteFeatures, int smileFeatures, OutputStream out)
     
    SmileGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, int streamWriteFeatures, int smileFeatures, OutputStream out, byte[] outputBuffer, int offset, boolean bufferRecyclable)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private final void
     
    private final void
     
    private int
    _appendReplacementChar(byte[] outBuf, int outputPtr)
     
    protected void
     
    private int
    _decodeAndWriteSurrogate(int surr1, int surr2, byte[] outBuf, int outputPtr)
     
    private final void
     
    private final int
     
    private final int
     
    protected final void
     
    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(String str, int inputPtr, int inputEnd)
     
     
    private int
    _readMore(InputStream in, byte[] readBuffer, int inputPtr, int inputEnd, int maxRead)
     
    protected void
     
    private final 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 final int
    _shortUTF8Encode(String str, int i, int end)
     
    private final 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 final int
    _shortUTF8Encode2(String str, int i, int end, int outputPtr)
     
    protected tools.jackson.core.StreamReadConstraints
    We need access to some reader-side constraints for safety-check within number decoding for : for now we need to rely on global defaults; should be ok for basic safeguarding.
    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).
    protected final void
     
    protected void
    _write7BitBinaryWithLength(byte[] data, int offset, int len)
     
    protected int
    _write7BitBinaryWithLength(InputStream in, int bytesLeft, byte[] buffer)
     
    private final void
    _writeByte(byte b)
     
    private final void
    _writeBytes(byte[] data, int offset, int len)
     
    private final void
    _writeBytes(byte b1, byte b2)
     
    private final void
    _writeBytes(byte b1, byte b2, byte b3)
     
    private final void
    _writeBytes(byte b1, byte b2, byte b3, byte b4)
     
    private final void
    _writeBytes(byte b1, byte b2, byte b3, byte b4, byte b5)
     
    private final void
    _writeBytes(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6)
     
    private final int
    _writeBytes(InputStream in, int bytesLeft)
     
    private final void
    _writeBytesLong(byte[] data, int offset, int len)
     
    protected void
     
    protected void
    _writeIntegralNumber(String enc, boolean neg)
     
    private final void
     
    private final void
     
    protected final void
    _writeName(tools.jackson.core.SerializableString name)
     
    protected final void
    _writeNameUnicode(tools.jackson.core.SerializableString name, byte[] bytes)
     
    private final void
    _writeNonSharedString(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 final void
     
    private final int
    _writeNumberNoChecks(int ptr, double d)
     
    private final int
    _writeNumberNoChecks(int ptr, int i)
     
    private final int
    _writeNumberNoChecks(int ptr, long l)
     
    private void
    Helper method for writing a 32-bit positive (really 31-bit then) value.
    private final void
     
    private final void
     
    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
     
    configure(SmileWriteFeature f, boolean state)
     
     
     
     
    final void
     
    tools.jackson.core.PrettyPrinter
     
    final boolean
     
    protected long
    Method for accessing offset of the next byte within the whole output stream that this generator has produced.
    tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamWriteCapability>
     
    tools.jackson.core.TokenStreamContext
     
    int
     
     
    tools.jackson.core.Version
     
    tools.jackson.core.JsonGenerator
    writeArray(double[] array, int offset, int length)
     
    tools.jackson.core.JsonGenerator
    writeArray(int[] array, int offset, int length)
     
    tools.jackson.core.JsonGenerator
    writeArray(long[] array, int offset, int length)
     
    int
    writeBinary(InputStream data, int dataLength)
     
    tools.jackson.core.JsonGenerator
    writeBinary(tools.jackson.core.Base64Variant b64variant, byte[] data, int offset, int len)
     
    int
    writeBinary(tools.jackson.core.Base64Variant b64variant, InputStream data, int dataLength)
     
    tools.jackson.core.JsonGenerator
    writeBoolean(boolean state)
     
    tools.jackson.core.JsonGenerator
    writeBytes(byte[] data, int offset, int len)
    Method for directly inserting specified bytes in output at current position.
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    Method that can be called to explicitly write Smile document header.
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeName(tools.jackson.core.SerializableString name)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeNumber(double d)
     
    tools.jackson.core.JsonGenerator
    writeNumber(float f)
     
    tools.jackson.core.JsonGenerator
    writeNumber(int i)
     
    tools.jackson.core.JsonGenerator
    writeNumber(long l)
     
    tools.jackson.core.JsonGenerator
    writeNumber(short v)
     
    tools.jackson.core.JsonGenerator
    writeNumber(String encodedValue)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writePropertyId(long id)
     
    tools.jackson.core.JsonGenerator
    writeRaw(byte b)
    Method for directly inserting specified byte in output at current position.
    tools.jackson.core.JsonGenerator
    writeRaw(char c)
     
    tools.jackson.core.JsonGenerator
    writeRaw(char[] text, int offset, int len)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeRaw(String text, int offset, int len)
     
    tools.jackson.core.JsonGenerator
    writeRawUTF8String(byte[] text, int offset, int len)
     
    tools.jackson.core.JsonGenerator
    writeRawValue(char[] text, int offset, int len)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeRawValue(String text, int offset, int len)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeStartArray(Object forValue, int size)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeStartObject(Object forValue, int size)
     
    tools.jackson.core.JsonGenerator
    writeString(char[] text, int offset, int len)
     
    tools.jackson.core.JsonGenerator
     
    tools.jackson.core.JsonGenerator
    writeString(tools.jackson.core.SerializableString sstr)
     
    tools.jackson.core.JsonGenerator
    writeUTF8String(byte[] text, int offset, int len)
     

    Methods inherited from class tools.jackson.core.base.GeneratorBase

    _asString, _checkRangeBoundsForByteArray, _checkRangeBoundsForCharArray, _checkRangeBoundsForString, _constructDefaultPrettyPrinter, _decodeSurrogate, _throwInternal, close, configure, has, ioContext, isClosed, isEnabled, objectWriteContext, streamWriteConstraints, streamWriteFeatures, writePOJO, writeRawValue, writeString, writeTree

    Methods inherited from class tools.jackson.core.JsonGenerator

    _constructWriteException, _constructWriteException, _constructWriteException, _constructWriteException, _copyCurrentContents, _copyCurrentContentsExact, _copyCurrentFloatValue, _copyCurrentFloatValueExact, _copyCurrentIntValue, _copyCurrentStringValue, _reportArgumentError, _reportError, _reportUnsupportedOperation, _reportUnsupportedOperation, _verifyOffsets, _wrapIOFailure, _writeTypePrefixUsingNative, _writeTypePrefixUsingWrapper, canOmitProperties, canWriteObjectId, canWriteTypeId, copyCurrentEvent, copyCurrentEventExact, copyCurrentStructure, copyCurrentStructureExact, getCharacterEscapes, getHighestNonEscapedChar, getSchema, setCharacterEscapes, writeArray, writeArrayPropertyStart, writeBinary, writeBinary, writeBinaryProperty, writeBooleanProperty, writeEmbeddedObject, writeNullProperty, writeNumber, writeNumberProperty, writeNumberProperty, writeNumberProperty, writeNumberProperty, writeNumberProperty, writeNumberProperty, writeNumberProperty, writeObjectId, writeObjectPropertyStart, writeObjectRef, writeOmittedProperty, writePOJOProperty, writeRaw, writeStringProperty, writeTypeId, writeTypePrefix, writeTypeSuffix

    Methods inherited from class Object

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

    • DEFAULT_NAME_BUFFER_LENGTH

      protected static final int DEFAULT_NAME_BUFFER_LENGTH
      See Also:
    • DEFAULT_STRING_VALUE_BUFFER_LENGTH

      protected static final int DEFAULT_STRING_VALUE_BUFFER_LENGTH
      See Also:
    • 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:
    • TOKEN_BYTE_LONG_STRING_ASCII

      protected static final byte TOKEN_BYTE_LONG_STRING_ASCII
      See Also:
    • TOKEN_BYTE_INT_32

      protected static final byte TOKEN_BYTE_INT_32
      See Also:
    • TOKEN_BYTE_INT_64

      protected static final byte TOKEN_BYTE_INT_64
      See Also:
    • TOKEN_BYTE_BIG_INTEGER

      protected static final byte TOKEN_BYTE_BIG_INTEGER
      See Also:
    • TOKEN_BYTE_FLOAT_32

      protected static final byte TOKEN_BYTE_FLOAT_32
      See Also:
    • TOKEN_BYTE_FLOAT_64

      protected static final byte TOKEN_BYTE_FLOAT_64
      See Also:
    • TOKEN_BYTE_BIG_DECIMAL

      protected static final byte TOKEN_BYTE_BIG_DECIMAL
      See Also:
    • MIN_INT_AS_LONG

      protected static final long MIN_INT_AS_LONG
      See Also:
    • MAX_INT_AS_LONG

      protected static final long MAX_INT_AS_LONG
      See Also:
    • REPLACEMENT_CHAR

      protected static final int REPLACEMENT_CHAR
      The replacement character to use to fix invalid Unicode sequences (mismatched surrogate pair).
      See Also:
    • _out

      protected final OutputStream _out
    • _formatFeatures

      protected int _formatFeatures
      Bit flag composed of bits that indicate which SmileWriteFeatures are enabled.
    • _streamWriteContext

      protected tools.jackson.core.util.SimpleStreamWriteContext _streamWriteContext
      Object that keeps track of the current contextual state of the generator.
    • _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 property 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 Details

    • SmileGenerator

      public SmileGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, int streamWriteFeatures, int smileFeatures, OutputStream out)
    • SmileGenerator

      public SmileGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, int streamWriteFeatures, int smileFeatures, OutputStream out, byte[] outputBuffer, int offset, boolean bufferRecyclable)
  • Method Details

    • writeHeader

      public tools.jackson.core.JsonGenerator writeHeader() throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • version

      public tools.jackson.core.Version version()
      Specified by:
      version in interface tools.jackson.core.Versioned
      Specified by:
      version in class tools.jackson.core.JsonGenerator
    • streamWriteCapabilities

      public tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamWriteCapability> streamWriteCapabilities()
      Specified by:
      streamWriteCapabilities in class tools.jackson.core.JsonGenerator
    • streamWriteOutputTarget

      public Object streamWriteOutputTarget()
      Specified by:
      streamWriteOutputTarget in class tools.jackson.core.JsonGenerator
    • streamWriteOutputBuffered

      public int streamWriteOutputBuffered()
      Specified by:
      streamWriteOutputBuffered in class tools.jackson.core.JsonGenerator
    • getPrettyPrinter

      public tools.jackson.core.PrettyPrinter getPrettyPrinter()
      Overrides:
      getPrettyPrinter in class tools.jackson.core.JsonGenerator
    • currentValue

      public Object currentValue()
      Specified by:
      currentValue in class tools.jackson.core.JsonGenerator
    • assignCurrentValue

      public void assignCurrentValue(Object v)
      Specified by:
      assignCurrentValue in class tools.jackson.core.JsonGenerator
    • streamWriteContext

      public tools.jackson.core.TokenStreamContext streamWriteContext()
      Specified by:
      streamWriteContext in class tools.jackson.core.JsonGenerator
    • writeName

      public tools.jackson.core.JsonGenerator writeName(String name) throws tools.jackson.core.JacksonException
      Specified by:
      writeName in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeName

      public tools.jackson.core.JsonGenerator writeName(tools.jackson.core.SerializableString name) throws tools.jackson.core.JacksonException
      Overrides:
      writeName in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writePropertyId

      public tools.jackson.core.JsonGenerator writePropertyId(long id) throws tools.jackson.core.JacksonException
      Specified by:
      writePropertyId in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • enable

      public SmileGenerator enable(SmileWriteFeature f)
    • disable

      public SmileGenerator disable(SmileWriteFeature f)
    • isEnabled

      public final boolean isEnabled(SmileWriteFeature f)
    • configure

      public SmileGenerator configure(SmileWriteFeature f, boolean state)
    • writeRaw

      public tools.jackson.core.JsonGenerator writeRaw(byte b) throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • writeBytes

      public tools.jackson.core.JsonGenerator writeBytes(byte[] data, int offset, int len) throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • writeStartArray

      public tools.jackson.core.JsonGenerator writeStartArray() throws tools.jackson.core.JacksonException
      Specified by:
      writeStartArray in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeStartArray

      public tools.jackson.core.JsonGenerator writeStartArray(Object forValue) throws tools.jackson.core.JacksonException
      Specified by:
      writeStartArray in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeStartArray

      public tools.jackson.core.JsonGenerator writeStartArray(Object forValue, int size) throws tools.jackson.core.JacksonException
      Overrides:
      writeStartArray in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeEndArray

      public tools.jackson.core.JsonGenerator writeEndArray() throws tools.jackson.core.JacksonException
      Specified by:
      writeEndArray in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeStartObject

      public tools.jackson.core.JsonGenerator writeStartObject() throws tools.jackson.core.JacksonException
      Specified by:
      writeStartObject in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeStartObject

      public tools.jackson.core.JsonGenerator writeStartObject(Object forValue) throws tools.jackson.core.JacksonException
      Specified by:
      writeStartObject in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeStartObject

      public tools.jackson.core.JsonGenerator writeStartObject(Object forValue, int size) throws tools.jackson.core.JacksonException
      Overrides:
      writeStartObject in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeEndObject

      public tools.jackson.core.JsonGenerator writeEndObject() throws tools.jackson.core.JacksonException
      Specified by:
      writeEndObject in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeArray

      public tools.jackson.core.JsonGenerator writeArray(int[] array, int offset, int length) throws tools.jackson.core.JacksonException
      Overrides:
      writeArray in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeArray

      public tools.jackson.core.JsonGenerator writeArray(long[] array, int offset, int length) throws tools.jackson.core.JacksonException
      Overrides:
      writeArray in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeArray

      public tools.jackson.core.JsonGenerator writeArray(double[] array, int offset, int length) throws tools.jackson.core.JacksonException
      Overrides:
      writeArray in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _writeName

      private final void _writeName(String name) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeNonShortFieldName

      private final void _writeNonShortFieldName(String name, int len) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeName

      protected final void _writeName(tools.jackson.core.SerializableString name) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeLongAsciiFieldName

      private final void _writeLongAsciiFieldName(byte[] bytes) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeNameUnicode

      protected final void _writeNameUnicode(tools.jackson.core.SerializableString name, byte[] bytes) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeSharedNameReference

      private final void _writeSharedNameReference(int ix) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • writeString

      public tools.jackson.core.JsonGenerator writeString(String text) throws tools.jackson.core.JacksonException
      Specified by:
      writeString in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _writeSharedStringValueReference

      private final void _writeSharedStringValueReference(int ix) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeNonSharedString

      private final void _writeNonSharedString(String text, int len) throws tools.jackson.core.JacksonException
      Helper method called to handle cases where String value to write is known to be long enough not to be shareable.
      Throws:
      tools.jackson.core.JacksonException
    • writeString

      public tools.jackson.core.JsonGenerator writeString(char[] text, int offset, int len) throws tools.jackson.core.JacksonException
      Specified by:
      writeString in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeString

      public tools.jackson.core.JsonGenerator writeString(tools.jackson.core.SerializableString sstr) throws tools.jackson.core.JacksonException
      Overrides:
      writeString in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeRawUTF8String

      public tools.jackson.core.JsonGenerator writeRawUTF8String(byte[] text, int offset, int len) throws tools.jackson.core.JacksonException
      Specified by:
      writeRawUTF8String in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeUTF8String

      public tools.jackson.core.JsonGenerator writeUTF8String(byte[] text, int offset, int len) throws tools.jackson.core.JacksonException
      Specified by:
      writeUTF8String in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeRaw

      public tools.jackson.core.JsonGenerator writeRaw(String text) throws tools.jackson.core.JacksonException
      Specified by:
      writeRaw in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeRaw

      public tools.jackson.core.JsonGenerator writeRaw(String text, int offset, int len) throws tools.jackson.core.JacksonException
      Specified by:
      writeRaw in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeRaw

      public tools.jackson.core.JsonGenerator writeRaw(char[] text, int offset, int len) throws tools.jackson.core.JacksonException
      Specified by:
      writeRaw in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeRaw

      public tools.jackson.core.JsonGenerator writeRaw(char c) throws tools.jackson.core.JacksonException
      Specified by:
      writeRaw in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeRawValue

      public tools.jackson.core.JsonGenerator writeRawValue(String text) throws tools.jackson.core.JacksonException
      Overrides:
      writeRawValue in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeRawValue

      public tools.jackson.core.JsonGenerator writeRawValue(String text, int offset, int len) throws tools.jackson.core.JacksonException
      Overrides:
      writeRawValue in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeRawValue

      public tools.jackson.core.JsonGenerator writeRawValue(char[] text, int offset, int len) throws tools.jackson.core.JacksonException
      Overrides:
      writeRawValue in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeBinary

      public tools.jackson.core.JsonGenerator writeBinary(tools.jackson.core.Base64Variant b64variant, byte[] data, int offset, int len) throws tools.jackson.core.JacksonException
      Specified by:
      writeBinary in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeBinary

      public int writeBinary(InputStream data, int dataLength) throws tools.jackson.core.JacksonException
      Overrides:
      writeBinary in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeBinary

      public int writeBinary(tools.jackson.core.Base64Variant b64variant, InputStream data, int dataLength) throws tools.jackson.core.JacksonException
      Overrides:
      writeBinary in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • writeBoolean

      public tools.jackson.core.JsonGenerator writeBoolean(boolean state) throws tools.jackson.core.JacksonException
      Specified by:
      writeBoolean in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeNull

      public tools.jackson.core.JsonGenerator writeNull() throws tools.jackson.core.JacksonException
      Specified by:
      writeNull in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(short v) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(int i) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _writeNumberNoChecks

      private final int _writeNumberNoChecks(int ptr, int i) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(long l) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _writeNumberNoChecks

      private final int _writeNumberNoChecks(int ptr, long l) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(BigInteger v) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(double d) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _writeNumberNoChecks

      private final int _writeNumberNoChecks(int ptr, double d) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(float f) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(BigDecimal dec) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • writeNumber

      public tools.jackson.core.JsonGenerator writeNumber(String encodedValue) throws tools.jackson.core.JacksonException
      Specified by:
      writeNumber in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _writeIntegralNumber

      protected void _writeIntegralNumber(String enc, boolean neg) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeDecimalNumber

      protected void _writeDecimalNumber(String enc) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _verifyValueWrite

      protected final void _verifyValueWrite(String typeMsg) throws tools.jackson.core.JacksonException
      Specified by:
      _verifyValueWrite in class tools.jackson.core.base.GeneratorBase
      Throws:
      tools.jackson.core.JacksonException
    • flush

      public final void flush() throws tools.jackson.core.JacksonException
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in class tools.jackson.core.JsonGenerator
      Throws:
      tools.jackson.core.JacksonException
    • _closeInput

      protected void _closeInput() throws IOException
      Specified by:
      _closeInput in class tools.jackson.core.base.GeneratorBase
      Throws:
      IOException
    • _shortUTF8Encode

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

      private final int _shortUTF8Encode2(char[] str, int i, int end, int outputPtr) throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • _shortUTF8Encode

      private final int _shortUTF8Encode(String str, int i, int end) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _shortUTF8Encode2

      private final int _shortUTF8Encode2(String str, int i, int end, int outputPtr) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _mediumUTF8Encode

      private void _mediumUTF8Encode(char[] str, int inputPtr, int inputEnd) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _mediumUTF8Encode

      private void _mediumUTF8Encode(String str, int inputPtr, int inputEnd) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _invalidSurrogateStart

      private int _invalidSurrogateStart(int code, byte[] outBuf, int outputPtr) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _invalidSurrogateEnd

      private int _invalidSurrogateEnd(int surr1, int surr2, byte[] outBuf, int outputPtr) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _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 tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeByte

      private final void _writeByte(byte b) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final void _writeBytes(byte b1, byte b2) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final void _writeBytes(byte b1, byte b2, byte b3) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final void _writeBytes(byte b1, byte b2, byte b3, byte b4) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final void _writeBytes(byte b1, byte b2, byte b3, byte b4, byte b5) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final void _writeBytes(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final void _writeBytes(byte[] data, int offset, int len) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytes

      private final int _writeBytes(InputStream in, int bytesLeft) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writeBytesLong

      private final void _writeBytesLong(byte[] data, int offset, int len) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _writePositiveVInt

      private void _writePositiveVInt(int i) throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • _writeSignedVInt

      private void _writeSignedVInt(int input) throws tools.jackson.core.JacksonException
      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:
      tools.jackson.core.JacksonException
    • _write7BitBinaryWithLength

      protected void _write7BitBinaryWithLength(byte[] data, int offset, int len) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _write7BitBinaryWithLength

      protected int _write7BitBinaryWithLength(InputStream in, int bytesLeft, byte[] buffer) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _readMore

      private int _readMore(InputStream in, byte[] readBuffer, int inputPtr, int inputEnd, int maxRead) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _releaseBuffers

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

      protected final void _flushBuffer() throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _findSeenName

      private final int _findSeenName(String name)
    • _addSeenName

      private final void _addSeenName(String name)
    • _findSeenStringValue

      private final int _findSeenStringValue(String text)
    • _addSeenStringValue

      private final void _addSeenStringValue(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 UnsupportedOperationException _notSupported()
    • _streamReadConstraints

      protected tools.jackson.core.StreamReadConstraints _streamReadConstraints()
      We need access to some reader-side constraints for safety-check within number decoding for : for now we need to rely on global defaults; should be ok for basic safeguarding.
      Since:
      2.17