java.lang.Object
io.helidon.json.JsonGeneratorBase
io.helidon.json.smile.SmileGenerator
- All Implemented Interfaces:
JsonGenerator,AutoCloseable
Smile binary JSON generator implementation.
This class is not thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method does not close the stream it is writing to.static JsonGeneratorcreate(OutputStream outputStream) Create aJsonGeneratorinstance producing Smile binary JSON into the providedOutputStream.static JsonGeneratorcreate(OutputStream outputStream, SmileConfig config) Create aJsonGeneratorinstance producing Smile binary JSON into the providedOutputStream.protected voidensureCapacity(int extra) Ensures there is enough capacity for an upcoming write operation.write(BigDecimal value) Write aBigDecimalvalue.write(BigInteger value) Write aBigIntegervalue.protected voidwriteBigDecimal(BigDecimal value) Writes a big decimal value.protected voidwriteBigInteger(BigInteger value) Writes a big integer value.protected voidwriteBinaryArray(byte[] value) Writes a binary value represented as a byte array.protected voidwriteBoolean(boolean value) Writes a boolean value.protected voidwriteByteExact(byte value) Writes the byte into the output.protected voidwriteChar(char value) Writes a character value.protected voidwriteControlByte(byte value) Writes a structural control byte, such as a comma, colon, or bracket.protected voidwriteDouble(double value) Writes a double value.protected voidwriteFloat(float value) Writes a float value.protected voidwriteInt(int value) Writes an integer value.protected voidwriteKeyName(JsonKey key) Writes an object key name using a precomputed key.protected voidwriteKeyName(String key) Writes an object key name.protected voidwriteLong(long value) Writes a long value.protected voidWrites the JSONnullvalue.protected voidwriteString(String value) Writes a string value.Methods inherited from class io.helidon.json.JsonGeneratorBase
write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, writeArrayEnd, writeArrayStart, writeBinary, writeBinary, writeBinary, writeKey, writeKey, writeNull, writeObjectEnd, writeObjectStart, writePrecomputedKey
-
Method Details
-
create
Create aJsonGeneratorinstance producing Smile binary JSON into the providedOutputStream.- Parameters:
outputStream- output stream to write Smile data to- Returns:
- new Smile generator instance
-
create
Create aJsonGeneratorinstance producing Smile binary JSON into the providedOutputStream.- Parameters:
outputStream- output stream to write Smile data toconfig- Smile configuration- Returns:
- new Smile generator instance
-
write
Description copied from interface:JsonGeneratorWrite aBigDecimalvalue.- Specified by:
writein interfaceJsonGenerator- Overrides:
writein classJsonGeneratorBase- Parameters:
value- the decimal value- Returns:
- this generator for method chaining
-
write
Description copied from interface:JsonGeneratorWrite aBigIntegervalue.- Specified by:
writein interfaceJsonGenerator- Overrides:
writein classJsonGeneratorBase- Parameters:
value- the big integer value- Returns:
- this generator for method chaining
-
close
public void close()Description copied from interface:JsonGeneratorThis method does not close the stream it is writing to. It only performs final writing operations. -
writeControlByte
protected void writeControlByte(byte value) Description copied from class:JsonGeneratorBaseWrites a structural control byte, such as a comma, colon, or bracket.- Overrides:
writeControlBytein classJsonGeneratorBase- Parameters:
value- control byte to write
-
writeByteExact
protected void writeByteExact(byte value) Description copied from class:JsonGeneratorBaseWrites the byte into the output. Example: byte 47 ->-.- Specified by:
writeByteExactin classJsonGeneratorBase- Parameters:
value- byte value
-
writeInt
protected void writeInt(int value) Description copied from class:JsonGeneratorBaseWrites an integer value.- Specified by:
writeIntin classJsonGeneratorBase- Parameters:
value- integer value to write
-
writeLong
protected void writeLong(long value) Description copied from class:JsonGeneratorBaseWrites a long value.- Specified by:
writeLongin classJsonGeneratorBase- Parameters:
value- long value to write
-
writeFloat
protected void writeFloat(float value) Description copied from class:JsonGeneratorBaseWrites a float value.- Specified by:
writeFloatin classJsonGeneratorBase- Parameters:
value- float value to write
-
writeDouble
protected void writeDouble(double value) Description copied from class:JsonGeneratorBaseWrites a double value.- Specified by:
writeDoublein classJsonGeneratorBase- Parameters:
value- double value to write
-
writeBigDecimal
Description copied from class:JsonGeneratorBaseWrites a big decimal value.- Specified by:
writeBigDecimalin classJsonGeneratorBase- Parameters:
value- big decimal value to write
-
writeBigInteger
Description copied from class:JsonGeneratorBaseWrites a big integer value.- Specified by:
writeBigIntegerin classJsonGeneratorBase- Parameters:
value- big integer value to write
-
writeString
Description copied from class:JsonGeneratorBaseWrites a string value.- Specified by:
writeStringin classJsonGeneratorBase- Parameters:
value- string value to write
-
writeKeyName
Description copied from class:JsonGeneratorBaseWrites an object key name.- Overrides:
writeKeyNamein classJsonGeneratorBase- Parameters:
key- key name to write
-
writeKeyName
Description copied from class:JsonGeneratorBaseWrites an object key name using a precomputed key.- Overrides:
writeKeyNamein classJsonGeneratorBase- Parameters:
key- key name to write
-
writeChar
protected void writeChar(char value) Description copied from class:JsonGeneratorBaseWrites a character value.- Specified by:
writeCharin classJsonGeneratorBase- Parameters:
value- character value to write
-
writeBoolean
protected void writeBoolean(boolean value) Description copied from class:JsonGeneratorBaseWrites a boolean value.- Specified by:
writeBooleanin classJsonGeneratorBase- Parameters:
value- boolean value to write
-
writeBinaryArray
protected void writeBinaryArray(byte[] value) Description copied from class:JsonGeneratorBaseWrites a binary value represented as a byte array.- Specified by:
writeBinaryArrayin classJsonGeneratorBase- Parameters:
value- binary value to write
-
writeNullValue
protected void writeNullValue()Description copied from class:JsonGeneratorBaseWrites the JSONnullvalue.- Specified by:
writeNullValuein classJsonGeneratorBase
-
ensureCapacity
protected void ensureCapacity(int extra) Description copied from class:JsonGeneratorBaseEnsures there is enough capacity for an upcoming write operation. Implementations with internal buffering can override this method.- Overrides:
ensureCapacityin classJsonGeneratorBase- Parameters:
extra- number of additional bytes or characters about to be written
-