java.lang.Object
io.helidon.json.JsonGeneratorBase
- All Implemented Interfaces:
JsonGenerator,AutoCloseable
Base implementation of
JsonGenerator with shared structure and state handling.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected default constructor for subclasses. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidensureCapacity(int extra) Ensures there is enough capacity for an upcoming write operation.write(boolean value) Write a boolean value.write(byte value) Write a byte value.write(char value) Write a char value.write(double value) Write a double value.write(float value) Write a float value.write(int value) Write an int value.write(long value) Write a long value.write(short value) Write a short value.Write a JsonValue.Write a string value.Write a key-value pair with a boolean value.Write a key-value pair with a char value.Write a key-value pair with a double value.Write a key-value pair with a float value.Write a key-value pair with an int value.Write a key-value pair with a long value.Write a key-value pair with a JsonValue.Write a key-value pair with a string value.write(String key, BigDecimal value) Write a key-value pair with aBigDecimalvalue.write(String key, BigInteger value) Write a key-value pair with aBigIntegervalue.write(BigDecimal value) Write aBigDecimalvalue.write(BigInteger value) Write aBigIntegervalue.Write the end of a JSON array.Write the start of a JSON array.protected abstract voidwriteBigDecimal(BigDecimal value) Writes a big decimal value.protected abstract voidwriteBigInteger(BigInteger value) Writes a big integer value.writeBinary(byte[] value) Write a value in a binary format.writeBinary(String key, byte[] value) Write a key-value pair with a value in a binary format.protected abstract voidwriteBinaryArray(byte[] value) Writes a binary value represented as a byte array.protected abstract voidwriteBoolean(boolean value) Writes a boolean value.protected abstract voidwriteByteExact(byte value) Writes the byte into the output.protected abstract voidwriteChar(char value) Writes a character value.protected voidwriteControlByte(byte value) Writes a structural control byte, such as a comma, colon, or bracket.protected abstract voidwriteDouble(double value) Writes a double value.protected abstract voidwriteFloat(float value) Writes a float value.protected abstract voidwriteInt(int value) Writes an integer value.Write a key value to the output stream.protected voidwriteKeyName(String value) Writes an object key name.protected abstract voidwriteLong(long value) Writes a long value.Write a null value.protected abstract voidWrites the JSONnullvalue.Write the end of a JSON object.Write the start of a JSON object.protected abstract voidwriteString(String value) Writes a string value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.json.JsonGenerator
close
-
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
Writes a big decimal value.- Parameters:
value- big decimal value to write
-
writeBigInteger
Writes a big integer value.- Parameters:
value- big integer value to write
-
writeKeyName
Writes an object key name.- Parameters:
value- key name to write
-
writeString
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 JSONnullvalue. -
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
Description copied from interface:JsonGeneratorWrite 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:
writeKeyin interfaceJsonGenerator- Parameters:
key- the key value to write- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a string value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the string value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with an int value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the int value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a long value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the long value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a float value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the float value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a double value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the double value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a boolean value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the boolean value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a char value.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the char value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with aBigDecimalvalue.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the decimal value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with aBigIntegervalue.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the big integer value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a key-value pair with a JsonValue.- Specified by:
writein interfaceJsonGenerator- Parameters:
key- the keyvalue- the JsonValue- Returns:
- this generator for method chaining
-
writeBinary
Description copied from interface:JsonGeneratorWrite a key-value pair with a value in a binary format.- Specified by:
writeBinaryin interfaceJsonGenerator- Parameters:
key- the keyvalue- the binary data value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a string value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the string value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a byte value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the byte value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a short value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the short value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite an int value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the int value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a long value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the long value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a float value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the float value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a double value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the double value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a boolean value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the boolean value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a char value.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the char value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite aBigDecimalvalue.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the decimal value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite aBigIntegervalue.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the big integer value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite a JsonValue.- Specified by:
writein interfaceJsonGenerator- Parameters:
value- the JsonValue to write- Returns:
- this generator for method chaining
-
writeBinary
Description copied from interface:JsonGeneratorWrite a value in a binary format.- Specified by:
writeBinaryin interfaceJsonGenerator- Parameters:
value- the binary data value- Returns:
- this generator for method chaining
-
writeNull
Description copied from interface:JsonGeneratorWrite a null value.- Specified by:
writeNullin interfaceJsonGenerator- Returns:
- this generator for method chaining
-
writeArrayStart
Description copied from interface:JsonGeneratorWrite the start of a JSON array.- Specified by:
writeArrayStartin interfaceJsonGenerator- Returns:
- this generator for method chaining
-
writeArrayEnd
Description copied from interface:JsonGeneratorWrite the end of a JSON array.- Specified by:
writeArrayEndin interfaceJsonGenerator- Returns:
- this generator for method chaining
-
writeObjectStart
Description copied from interface:JsonGeneratorWrite the start of a JSON object.- Specified by:
writeObjectStartin interfaceJsonGenerator- Returns:
- this generator for method chaining
-
writeObjectEnd
Description copied from interface:JsonGeneratorWrite the end of a JSON object.- Specified by:
writeObjectEndin interfaceJsonGenerator- Returns:
- this generator for method chaining
-