Package com.fauna.codec
Class UTF8FaunaGenerator
- java.lang.Object
- 
- com.fauna.codec.UTF8FaunaGenerator
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable
 
 public final class UTF8FaunaGenerator extends java.lang.Object implements java.lang.AutoCloseableA generator for encoding JSON with Fauna-specific tagged values and other data types.
- 
- 
Constructor SummaryConstructors Constructor Description UTF8FaunaGenerator()Initializes a new instance of theUTF8FaunaGeneratorclass.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the generator and the underlying resources.static UTF8FaunaGeneratorcreate()Creates a newUTF8FaunaGeneratorinstance.voidflush()Flushes the written data to the underlying buffer or stream.java.lang.Stringserialize()Serializes the current state of the generator's buffer as a UTF-8 encoded string.voidwriteBoolean(java.lang.String fieldName, boolean value)Writes a boolean value with a specific field name.voidwriteBooleanValue(boolean value)Writes a boolean value to the stream.voidwriteBytesValue(byte[] value)Writes a byte array encoded as a base64 string as a tagged element.voidwriteCharValue(java.lang.Character value)Writes a character value as an integer.voidwriteDate(java.lang.String fieldName, java.time.LocalDate value)Writes a date value with a specific field name.voidwriteDateValue(java.time.LocalDate value)Writes a date value as a tagged element.voidwriteDouble(java.lang.String fieldName, double value)Writes a double value with a specific field name.voidwriteDoubleValue(double value)Writes a double value as a tagged element.voidwriteDoubleValue(float value)Writes a float value as a tagged element (@double).voidwriteEndArray()Writes the end of an array.voidwriteEndEscapedObject()Writes the end of a specially tagged object.voidwriteEndObject()Writes the end of an object.voidwriteEndRef()Writes the end of a reference object.voidwriteFieldName(java.lang.String value)Writes a field name for the next value.voidwriteInt(java.lang.String fieldName, int value)Writes an integer value with a specific field name.voidwriteIntValue(int value)Writes an integer value as a tagged element.voidwriteLong(java.lang.String fieldName, long value)Writes a long integer value with a specific field name.voidwriteLongValue(long value)Writes a long integer value as a tagged element.voidwriteModule(java.lang.String fieldName, Module value)Writes a module value with a specific field name.voidwriteModuleValue(Module value)Writes a module value as a tagged element.voidwriteNull(java.lang.String fieldName)Writes a null value with a specific field name.voidwriteNullValue()Writes a null value to the stream.voidwriteStartArray()Writes the beginning of an array.voidwriteStartEscapedObject()Writes the beginning of a specially tagged object.voidwriteStartObject()Writes the beginning of an object.voidwriteStartRef()Writes the beginning of a reference object.voidwriteString(java.lang.String fieldName, java.lang.String value)Writes a string value with a specific field name.voidwriteStringValue(java.lang.String value)Writes a string value as a tagged element.voidwriteTaggedValue(java.lang.String tag, java.lang.String value)Writes a tagged value in an object.voidwriteTime(java.lang.String fieldName, java.time.Instant value)Writes a time value with a specific field name.voidwriteTimeValue(java.time.Instant value)Writes a time value as a tagged element.
 
- 
- 
- 
Method Detail- 
createpublic static UTF8FaunaGenerator create() throws CodecException Creates a newUTF8FaunaGeneratorinstance.- Returns:
- A new instance of the UTF8FaunaGenerator.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
flushpublic void flush() throws CodecExceptionFlushes the written data to the underlying buffer or stream.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
serializepublic java.lang.String serialize() throws CodecExceptionSerializes the current state of the generator's buffer as a UTF-8 encoded string.- Returns:
- A string representation of the serialized output.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeStartObjectpublic void writeStartObject() throws CodecExceptionWrites the beginning of an object.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeEndObjectpublic void writeEndObject() throws CodecExceptionWrites the end of an object.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeStartEscapedObjectpublic void writeStartEscapedObject() throws CodecExceptionWrites the beginning of a specially tagged object.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeEndEscapedObjectpublic void writeEndEscapedObject() throws CodecExceptionWrites the end of a specially tagged object.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeStartArraypublic void writeStartArray() throws CodecExceptionWrites the beginning of an array.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeEndArraypublic void writeEndArray() throws CodecExceptionWrites the end of an array.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeStartRefpublic void writeStartRef() throws CodecExceptionWrites the beginning of a reference object.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeEndRefpublic void writeEndRef() throws CodecExceptionWrites the end of a reference object.- Throws:
- CodecException- If an error occurs.
 
 - 
writeDoublepublic void writeDouble(java.lang.String fieldName, double value) throws CodecExceptionWrites a double value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The double value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeIntpublic void writeInt(java.lang.String fieldName, int value) throws CodecExceptionWrites an integer value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The integer value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeLongpublic void writeLong(java.lang.String fieldName, long value) throws CodecExceptionWrites a long integer value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The long integer value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeStringpublic void writeString(java.lang.String fieldName, java.lang.String value) throws CodecExceptionWrites a string value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The string value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeDatepublic void writeDate(java.lang.String fieldName, java.time.LocalDate value) throws CodecExceptionWrites a date value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The date value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeTimepublic void writeTime(java.lang.String fieldName, java.time.Instant value) throws CodecExceptionWrites a time value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The time value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeBooleanpublic void writeBoolean(java.lang.String fieldName, boolean value) throws CodecExceptionWrites a boolean value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The boolean value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeNullpublic void writeNull(java.lang.String fieldName) throws CodecExceptionWrites a null value with a specific field name.- Parameters:
- fieldName- The name of the field.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeModulepublic void writeModule(java.lang.String fieldName, Module value) throws CodecExceptionWrites a module value with a specific field name.- Parameters:
- fieldName- The name of the field.
- value- The Module value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeFieldNamepublic void writeFieldName(java.lang.String value) throws CodecExceptionWrites a field name for the next value.- Parameters:
- value- The name of the field.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeTaggedValuepublic void writeTaggedValue(java.lang.String tag, java.lang.String value) throws CodecExceptionWrites a tagged value in an object.- Parameters:
- tag- The tag to use for the value.
- value- The value associated with the tag.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeDoubleValuepublic void writeDoubleValue(double value) throws CodecExceptionWrites a double value as a tagged element.- Parameters:
- value- The double value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeDoubleValuepublic void writeDoubleValue(float value) throws CodecExceptionWrites a float value as a tagged element (@double).- Parameters:
- value- The float value to write as a double.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeIntValuepublic void writeIntValue(int value) throws CodecExceptionWrites an integer value as a tagged element.- Parameters:
- value- The integer value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeLongValuepublic void writeLongValue(long value) throws CodecExceptionWrites a long integer value as a tagged element.- Parameters:
- value- The long integer value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeStringValuepublic void writeStringValue(java.lang.String value) throws CodecExceptionWrites a string value as a tagged element.- Parameters:
- value- The string value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeDateValuepublic void writeDateValue(java.time.LocalDate value) throws CodecExceptionWrites a date value as a tagged element.- Parameters:
- value- The date value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeTimeValuepublic void writeTimeValue(java.time.Instant value) throws CodecExceptionWrites a time value as a tagged element.- Parameters:
- value- The time value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeBooleanValuepublic void writeBooleanValue(boolean value) throws CodecExceptionWrites a boolean value to the stream.- Parameters:
- value- The boolean value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeCharValuepublic void writeCharValue(java.lang.Character value) throws CodecExceptionWrites a character value as an integer.- Parameters:
- value- The character value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeNullValuepublic void writeNullValue() throws CodecExceptionWrites a null value to the stream.- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeModuleValuepublic void writeModuleValue(Module value) throws CodecException Writes a module value as a tagged element.- Parameters:
- value- The module value to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
writeBytesValuepublic void writeBytesValue(byte[] value) throws CodecExceptionWrites a byte array encoded as a base64 string as a tagged element.- Parameters:
- value- The byte array to write.
- Throws:
- CodecException- If an I/O error occurs.
 
 - 
closepublic void close() throws CodecExceptionCloses the generator and the underlying resources.- Specified by:
- closein interface- java.lang.AutoCloseable
- Throws:
- CodecException- If an I/O error occurs during closing.
 
 
- 
 
-