Class WriterBasedGenerator

All Implemented Interfaces:
Closeable, AutoCloseable, Versioned

public final class WriterBasedGenerator extends JsonGeneratorBase
JsonGenerator that outputs JSON content using a Writer which handles character encoding.
  • Field Details

    • SHORT_WRITE

      protected static final int SHORT_WRITE
      See Also:
    • HEX_CHARS

      protected static final char[] HEX_CHARS
    • sOutputEscapes

      protected static final int[] sOutputEscapes
      This is the default set of escape codes, over 7-bit ASCII range (first 128 character codes), used for single-byte UTF-8 characters.
    • _ioContext

      protected final IOContext _ioContext
    • _writer

      protected final Writer _writer
    • _outputEscapes

      protected int[] _outputEscapes
      Currently active set of output escape code definitions (whether and how to escape or not) for 7-bit ASCII range (first 128 character codes). Defined separately to make potentially customizable
    • _maximumNonEscapedChar

      protected int _maximumNonEscapedChar
      Value between 128 (0x80) and 65535 (0xFFFF) that indicates highest Unicode code point that will not need escaping; or 0 to indicate that all characters can be represented without escaping. Typically used to force escaping of some portion of character set; for example to always escape non-ASCII characters (if value was 127).

      NOTE: not all sub-classes make use of this setting.

    • _characterEscapes

      protected CharacterEscapes _characterEscapes
      Definition of custom character escapes to use for generators created by this factory, if any. If null, standard data format specific escapes are used.
      Since:
      1.8
    • _currentEscape

      protected SerializableString _currentEscape
      When custom escapes are used, this member variable can be used to store escape to use
      Since:
      1.8
    • _outputBuffer

      protected char[] _outputBuffer
      Intermediate buffer in which contents are buffered before being written using _writer.
    • _outputHead

      protected int _outputHead
      Pointer to the first buffered character to output
    • _outputTail

      protected int _outputTail
      Pointer to the position right beyond the last character to output (end marker; may point to position right beyond the end of the buffer)
    • _outputEnd

      protected int _outputEnd
      End marker of the output buffer; one past the last valid position within the buffer.
    • _entityBuffer

      protected char[] _entityBuffer
      Short (14 char) temporary buffer allocated if needed, for constructing escape sequences
  • Constructor Details

  • Method Details