Class JsonGeneratorBase

java.lang.Object
io.helidon.json.JsonGeneratorBase
All Implemented Interfaces:
JsonGenerator, AutoCloseable

public abstract class JsonGeneratorBase extends Object implements JsonGenerator
Base implementation of JsonGenerator with shared structure and state handling.
  • Constructor Details

    • JsonGeneratorBase

      protected JsonGeneratorBase()
      Protected default constructor for subclasses.
  • Method Details

    • writeControlByte

      protected void writeControlByte(byte value)
      Writes a structural control byte, such as a comma, colon, or bracket.
      Parameters:
      value - control byte to write
    • writeByteExact

      protected abstract void writeByteExact(byte value)
      Writes the byte into the output. Example: byte 47 -> -.
      Parameters:
      value - byte value
    • writeInt

      protected abstract void writeInt(int value)
      Writes an integer value.
      Parameters:
      value - integer value to write
    • writeLong

      protected abstract void writeLong(long value)
      Writes a long value.
      Parameters:
      value - long value to write
    • writeFloat

      protected abstract void writeFloat(float value)
      Writes a float value.
      Parameters:
      value - float value to write
    • writeDouble

      protected abstract void writeDouble(double value)
      Writes a double value.
      Parameters:
      value - double value to write
    • writeBigDecimal

      protected abstract void writeBigDecimal(BigDecimal value)
      Writes a big decimal value.
      Parameters:
      value - big decimal value to write
    • writeBigInteger

      protected abstract void writeBigInteger(BigInteger value)
      Writes a big integer value.
      Parameters:
      value - big integer value to write
    • writeKeyName

      protected void writeKeyName(String value)
      Writes an object key name.
      Parameters:
      value - key name to write
    • writeString

      protected abstract void writeString(String value)
      Writes a string value.
      Parameters:
      value - string value to write
    • writeChar

      protected abstract void writeChar(char value)
      Writes a character value.
      Parameters:
      value - character value to write
    • writeBoolean

      protected abstract void writeBoolean(boolean value)
      Writes a boolean value.
      Parameters:
      value - boolean value to write
    • writeBinaryArray

      protected abstract void writeBinaryArray(byte[] value)
      Writes a binary value represented as a byte array.
      Parameters:
      value - binary value to write
    • writeNullValue

      protected abstract void writeNullValue()
      Writes the JSON null value.
    • ensureCapacity

      protected void ensureCapacity(int extra)
      Ensures there is enough capacity for an upcoming write operation. Implementations with internal buffering can override this method.
      Parameters:
      extra - number of additional bytes or characters about to be written
    • writeKey

      public JsonGenerator writeKey(String key)
      Description copied from interface: JsonGenerator
      Write a key value to the output stream.

      Each key will be automatically enclosed with quotes and a colon appended "key":. This method is used for writing JSON object keys.

      Specified by:
      writeKey in interface JsonGenerator
      Parameters:
      key - the key value to write
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, String value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a string value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the string value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, int value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with an int value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the int value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, long value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a long value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the long value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, float value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a float value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the float value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, double value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a double value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the double value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, boolean value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a boolean value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the boolean value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, char value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a char value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the char value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, BigDecimal value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a BigDecimal value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the decimal value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, BigInteger value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a BigInteger value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the big integer value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String key, JsonValue value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a JsonValue.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      key - the key
      value - the JsonValue
      Returns:
      this generator for method chaining
    • writeBinary

      public JsonGenerator writeBinary(String key, byte[] value)
      Description copied from interface: JsonGenerator
      Write a key-value pair with a value in a binary format.
      Specified by:
      writeBinary in interface JsonGenerator
      Parameters:
      key - the key
      value - the binary data value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(String value)
      Description copied from interface: JsonGenerator
      Write a string value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the string value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(byte value)
      Description copied from interface: JsonGenerator
      Write a byte value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the byte value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(short value)
      Description copied from interface: JsonGenerator
      Write a short value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the short value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(int value)
      Description copied from interface: JsonGenerator
      Write an int value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the int value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(long value)
      Description copied from interface: JsonGenerator
      Write a long value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the long value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(float value)
      Description copied from interface: JsonGenerator
      Write a float value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the float value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(double value)
      Description copied from interface: JsonGenerator
      Write a double value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the double value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(boolean value)
      Description copied from interface: JsonGenerator
      Write a boolean value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the boolean value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(char value)
      Description copied from interface: JsonGenerator
      Write a char value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the char value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(BigDecimal value)
      Description copied from interface: JsonGenerator
      Write a BigDecimal value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the decimal value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(BigInteger value)
      Description copied from interface: JsonGenerator
      Write a BigInteger value.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the big integer value
      Returns:
      this generator for method chaining
    • write

      public JsonGenerator write(JsonValue value)
      Description copied from interface: JsonGenerator
      Write a JsonValue.
      Specified by:
      write in interface JsonGenerator
      Parameters:
      value - the JsonValue to write
      Returns:
      this generator for method chaining
    • writeBinary

      public JsonGenerator writeBinary(byte[] value)
      Description copied from interface: JsonGenerator
      Write a value in a binary format.
      Specified by:
      writeBinary in interface JsonGenerator
      Parameters:
      value - the binary data value
      Returns:
      this generator for method chaining
    • writeNull

      public JsonGenerator writeNull()
      Description copied from interface: JsonGenerator
      Write a null value.
      Specified by:
      writeNull in interface JsonGenerator
      Returns:
      this generator for method chaining
    • writeArrayStart

      public JsonGenerator writeArrayStart()
      Description copied from interface: JsonGenerator
      Write the start of a JSON array.
      Specified by:
      writeArrayStart in interface JsonGenerator
      Returns:
      this generator for method chaining
    • writeArrayEnd

      public JsonGenerator writeArrayEnd()
      Description copied from interface: JsonGenerator
      Write the end of a JSON array.
      Specified by:
      writeArrayEnd in interface JsonGenerator
      Returns:
      this generator for method chaining
    • writeObjectStart

      public JsonGenerator writeObjectStart()
      Description copied from interface: JsonGenerator
      Write the start of a JSON object.
      Specified by:
      writeObjectStart in interface JsonGenerator
      Returns:
      this generator for method chaining
    • writeObjectEnd

      public JsonGenerator writeObjectEnd()
      Description copied from interface: JsonGenerator
      Write the end of a JSON object.
      Specified by:
      writeObjectEnd in interface JsonGenerator
      Returns:
      this generator for method chaining