Package com.alibaba.fastjson2
Class JSONWriterUTF16JDK8UF
java.lang.Object
com.alibaba.fastjson2.JSONWriter
com.alibaba.fastjson2.JSONWriterUTF16JDK8UF
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class com.alibaba.fastjson2.JSONWriter
JSONWriter.Context, JSONWriter.Feature, JSONWriter.Path -
Field Summary
FieldsFields inherited from class com.alibaba.fastjson2.JSONWriter
attachment, charset, context, jsonb, lastReference, level, MASK_BROWSER_COMPATIBLE, MASK_BROWSER_SECURE, MASK_ESCAPE_NONE_ASCII, MASK_IGNORE_NON_FIELD_GETTER, MASK_NOT_WRITE_DEFAULT_VALUE, MASK_NOT_WRITE_EMPTY_ARRAY, MASK_NOT_WRITE_NUMBER_CLASS_NAME, MASK_NULL_AS_DEFAULT_VALUE, MASK_PRETTY_FORMAT, MASK_REFERENCE_DETECTION, MASK_USE_SINGLE_QUOTES, MASK_WRITE_BOOLEAN_AS_NUMBER, MASK_WRITE_CLASS_NAME, MASK_WRITE_ENUM_USING_TO_STRING, MASK_WRITE_ENUMS_USING_NAME, MASK_WRITE_LONG_AS_STRING, MASK_WRITE_MAP_NULL_VALUE, MASK_WRITE_NON_STRING_VALUE_AS_STRING, MASK_WRITE_NULL_BOOLEAN_AS_FALSE, MASK_WRITE_NULL_LIST_AS_EMPTY, MASK_WRITE_NULL_NUMBER_AS_ZERO, MASK_WRITE_NULL_STRING_AS_EMPTY, maxArraySize, off, path, pretty, quote, refs, rootObject, startObject, symbolTable, useSingleQuote, utf16, utf8 -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Closes this JSONWriter and releases any resources associated with it.final voidendArray()Ends the current JSON array.final voidEnds writing a JSON object.final ObjectensureCapacity(int minCapacity) Ensures that the internal buffer has at least the specified minimum capacity.final intflushTo(OutputStream out) Flushes the content of this JSONWriter to the specified OutputStream.final intflushTo(OutputStream out, Charset charset) Flushes the content of this JSONWriter to the specified OutputStream using the specified charset.final voidFlushes the content of this JSONWriter to the specified Writer.final byte[]getBytes()Gets the content of the output buffer as a byte array.final byte[]Gets the content of the output buffer as a byte array using the specified charset.protected final voidgrow0(int minCapacity) final intsize()Gets the current size of the output buffer.final voidStarts writing a JSON array.final voidStarts writing a JSON object.final StringtoString()final voidWrites a list as a JSON array.final voidWrites a Map as a JSON object.protected final voidwrite0(char c) Writes a character to the output.final voidwriteBase64(byte[] bytes) Writes a byte array as Base64-encoded string.final voidwriteBigInt(BigInteger value, long features) Writes a BigInteger value using the specified features.voidwriteBool(boolean value) Writes a boolean value.final voidwriteChar(char ch) Writes a character without any escaping or formatting.final voidWrites a colon separator.final voidWrites a comma separator.final voidwriteDateTime14(int year, int month, int dayOfMonth, int hour, int minute, int second) Writes a date-time value in 14-character format (yyyyMMddHHmmss).final voidwriteDateTime19(int year, int month, int dayOfMonth, int hour, int minute, int second) Writes a date-time value in 19-character format (yyyy-MM-dd HH:mm:ss).final voidwriteDateTimeISO8601(int year, int month, int dayOfMonth, int hour, int minute, int second, int millis, int offsetSeconds, boolean timeZone) Writes a date-time value in ISO8601 format.final voidwriteDateYYYMMDD10(int year, int month, int dayOfMonth) Writes a date in 10-character format (yyyy-MM-dd).final voidwriteDateYYYMMDD8(int year, int month, int dayOfMonth) Writes a date in 8-character format (yyyyMMdd).final voidwriteDecimal(BigDecimal value, long features, DecimalFormat format) Writes a BigDecimal value using the specified features and decimal format.final voidwriteDouble(double value) Writes a double value.final voidwriteDouble(double[] values) Writes a double array as floating-point numbers.final voidwriteDoubleArray(double value0, double value1) Writes a double array with two elements.final voidwriteFloat(float value) Writes a float value.final voidwriteFloat(float[] values) final voidwriteHex(byte[] bytes) Writes a byte array as hexadecimal string.final voidwriteInt16(short i) Writes a short value as an integer.final voidwriteInt32(int i) Writes an int value.final voidwriteInt32(int[] value) Writes an int array as integers.final voidWrites an Integer object.final voidwriteInt64(long i) Writes a long value.final voidwriteInt64(long[] values) Writes a long array as integers.final voidwriteInt64(Long i) Writes a Long object.final voidwriteInt8(byte i) Writes a byte value as an integer.final voidwriteInt8(byte[] value) Writes a byte array as integers.final voidwriteListInt32(List<Integer> values) Writes a list of Integer values as integers.final voidwriteListInt64(List<Long> values) Writes a list of Long values as integers.final voidwriteLocalDate(LocalDate date) Writes a LocalDate value.final voidwriteLocalDateTime(LocalDateTime dateTime) Writes a LocalDateTime value.final voidwriteLocalTime(LocalTime time) Writes a LocalTime value.final voidwriteName10Raw(long name0, long name1) Writes a 10-character field name as raw bytes without any escaping or formatting.final voidwriteName11Raw(long name0, long name1) Writes an 11-character field name as raw bytes without any escaping or formatting.final voidwriteName12Raw(long name0, long name1) Writes a 12-character field name as raw bytes without any escaping or formatting.final voidwriteName13Raw(long name0, long name1) Writes a 13-character field name as raw bytes without any escaping or formatting.final voidwriteName14Raw(long name0, long name1) Writes a 14-character field name as raw bytes without any escaping or formatting.final voidwriteName15Raw(long name0, long name1) Writes a 15-character field name as raw bytes without any escaping or formatting.final voidwriteName16Raw(long name0, long name1) Writes a 16-character field name as raw bytes without any escaping or formatting.final voidwriteName2Raw(long name) Writes a 2-character field name as raw bytes without any escaping or formatting.final voidwriteName3Raw(long name) Writes a 3-character field name as raw bytes without any escaping or formatting.final voidwriteName4Raw(long name) Writes a 4-character field name as raw bytes without any escaping or formatting.final voidwriteName5Raw(long name) Writes a 5-character field name as raw bytes without any escaping or formatting.final voidwriteName6Raw(long name) Writes a 6-character field name as raw bytes without any escaping or formatting.final voidwriteName7Raw(long name) Writes a 7-character field name as raw bytes without any escaping or formatting.final voidwriteName8Raw(long name) Writes an 8-character field name as raw bytes without any escaping or formatting.final voidwriteName9Raw(long name0, int name1) Writes a 9-character field name as raw bytes without any escaping or formatting.final voidwriteNameRaw(byte[] bytes) Writes raw bytes representing a field name without any escaping or formatting.final voidwriteNameRaw(char[] name) Writes raw characters representing a field name without any escaping or formatting.final voidwriteNameRaw(char[] name, int coff, int len) Writes raw characters representing a field name without any escaping or formatting.final voidWrites a null value.final voidwriteOffsetDateTime(OffsetDateTime dateTime) Writes an OffsetDateTime value.final voidwriteOffsetTime(OffsetTime time) Writes an OffsetTime value.final voidwriteRaw(byte[] bytes) Writes raw bytes without any escaping or formatting.final voidwriteRaw(char ch) Writes a raw character without any escaping or formatting.final voidwriteRaw(char[] str, int coff, int strlen) Writes raw characters without any escaping or formatting.final voidwriteRaw(char c0, char c1) Writes two raw characters without any escaping or formatting.final voidWrites a raw string without any escaping or formatting.final voidwriteReference(String path) Writes a reference to a previously serialized object.final voidwriteString(boolean value) Writes a boolean value as a string.final voidwriteString(byte value) Writes a byte value as a string.final voidwriteString(char[] value) Writes a string from character array.final voidwriteString(char[] str, int coff, int len) Writes a string from character array with specified offset and length.final voidwriteString(char[] str, int offset, int len, boolean quoted) Writes a string from character array with specified offset and length.final voidwriteString(int value) Writes an int value as a string.final voidwriteString(long value) Writes a long value as a string.final voidwriteString(short value) Writes a short value as a string.voidwriteString(String str) Writes a string value.final voidwriteString(String[] strings) Writes an array of strings as a JSON array.final voidwriteString(List<String> list) Writes a list of strings as a JSON array.protected final voidwriteStringEscape(byte[] str) protected final voidwriteStringEscape(char[] str) protected final voidwriteStringEscape(String str) protected final voidwriteStringEscapeUTF16(byte[] str) voidwriteStringLatin1(byte[] value) Writes a string from Latin-1 encoded bytes.protected final voidwriteStringLatin1BrowserSecure(byte[] value) voidwriteStringUTF16(byte[] value) Writes a string from UTF-16 encoded bytes.final voidwriteTimeHHMMSS8(int hour, int minute, int second) Writes a time in 8-character format (HH:mm:ss).final voidWrites a UUID value.final voidwriteZonedDateTime(ZonedDateTime dateTime) Writes a ZonedDateTime value.Methods inherited from class com.alibaba.fastjson2.JSONWriter
addManagerReference, checkAndWriteTypeName, config, config, containsReference, decrementIdent, getAttachment, getCharset, getContext, getFeatures, getFeatures, getObjectWriter, getObjectWriter, getObjectWriter, getOffset, getPath, getPath, getSymbolTable, hasFilter, hasFilter, hasFilter, illegalYear, incrementIndent, isBeanToArray, isEnabled, isEnabled, isIgnoreErrorGetter, isIgnoreNoneSerializable, isIgnoreNoneSerializable, isRefDetect, isRefDetect, isUseSingleQuotes, isUTF16, isUTF8, isWriteAsString, isWriteAsString, isWriteAsString, isWriteMapTypeInfo, isWriteNulls, isWriteTypeInfo, isWriteTypeInfo, isWriteTypeInfo, isWriteTypeInfo, isWriteTypeInfo, isWriteTypeInfo, level, newCapacity, of, of, of, of, ofJSONB, ofJSONB, ofJSONB, ofJSONB, ofJSONB, ofPretty, ofPretty, ofUTF16, ofUTF8, ofUTF8, ofUTF8, overflowLevel, popPath, popPath0, println, removeReference, setAttachment, setOffset, setPath, setPath, setPath, setPath0, setPath0, setRootObject, startArray, startArray, startArray0, startArray1, startArray10, startArray11, startArray12, startArray13, startArray14, startArray15, startArray2, startArray3, startArray4, startArray5, startArray6, startArray7, startArray8, startArray9, write, writeAny, writeArrayNull, writeArrayNull, writeAs, writeBigInt, writeBinary, writeBool, writeBooleanNull, writeDecimal, writeDecimal, writeDecimalNull, writeDecimalNull, writeDouble, writeDouble, writeEnum, writeFloat, writeFloat, writeFloat, writeInstant, writeInt16, writeInt32, writeInt32, writeInt64Null, writeLocalDateWithFormat, writeMillis, writeName, writeName, writeName, writeNameAny, writeNameRaw, writeNameRaw, writeNameValue, writeNumberNull, writeNumberNull, writeObjectNull, writeRaw, writeRaw, writeReference, writeReference, writeString, writeString, writeString, writeString, writeString, writeString, writeString, writeString, writeString, writeString, writeStringNull, writeSymbol, writeSymbol, writeTypeName, writeTypeName
-
Field Details
-
chars
protected char[] chars -
byteVectorQuote
protected final long byteVectorQuote
-
-
Method Details
-
writeString
Description copied from class:JSONWriterWrites a string value.- Parameters:
str- the string to write, can be null
-
writeNull
public final void writeNull()Description copied from class:JSONWriterWrites a null value.- Specified by:
writeNullin classJSONWriter
-
flushTo
Description copied from class:JSONWriterFlushes the content of this JSONWriter to the specified Writer. This method converts the current content to a string and writes it to the provided Writer, then resets the internal buffer offset to zero.- Overrides:
flushToin classJSONWriter- Parameters:
to- the Writer to flush content to
-
close
public final void close()Description copied from class:JSONWriterCloses this JSONWriter and releases any resources associated with it. This method should be called when finished with the writer to ensure proper cleanup of resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classJSONWriter
-
write0
protected final void write0(char c) Description copied from class:JSONWriterWrites a character to the output.- Specified by:
write0in classJSONWriter- Parameters:
c- the character to write
-
writeColon
public final void writeColon()Description copied from class:JSONWriterWrites a colon separator.- Specified by:
writeColonin classJSONWriter
-
startObject
public final void startObject()Description copied from class:JSONWriterStarts writing a JSON object. This method writes the opening brace '{' and prepares the writer for writing key-value pairs.- Specified by:
startObjectin classJSONWriter
-
endObject
public final void endObject()Description copied from class:JSONWriterEnds writing a JSON object. This method writes the closing brace '}' and completes the current object.- Specified by:
endObjectin classJSONWriter
-
writeComma
public final void writeComma()Description copied from class:JSONWriterWrites a comma separator.- Specified by:
writeCommain classJSONWriter
-
startArray
public final void startArray()Description copied from class:JSONWriterStarts writing a JSON array. This method writes the opening bracket '[' and prepares the writer for writing array elements.- Specified by:
startArrayin classJSONWriter
-
endArray
public final void endArray()Description copied from class:JSONWriterEnds the current JSON array.- Specified by:
endArrayin classJSONWriter
-
writeString
Description copied from class:JSONWriterWrites a list of strings as a JSON array. Each string in the list is written as a separate string value in the array.- Overrides:
writeStringin classJSONWriter- Parameters:
list- the list of strings to write, can be null
-
writeStringLatin1
public void writeStringLatin1(byte[] value) Description copied from class:JSONWriterWrites a string from Latin-1 encoded bytes.- Specified by:
writeStringLatin1in classJSONWriter- Parameters:
value- the Latin-1 encoded bytes to write
-
writeStringLatin1BrowserSecure
protected final void writeStringLatin1BrowserSecure(byte[] value) -
writeStringUTF16
public void writeStringUTF16(byte[] value) Description copied from class:JSONWriterWrites a string from UTF-16 encoded bytes.- Specified by:
writeStringUTF16in classJSONWriter- Parameters:
value- the UTF-16 encoded bytes to write
-
writeStringEscape
-
writeStringEscapeUTF16
protected final void writeStringEscapeUTF16(byte[] str) -
writeStringEscape
protected final void writeStringEscape(char[] str) -
writeStringEscape
protected final void writeStringEscape(byte[] str) -
writeString
public final void writeString(char[] str, int offset, int len, boolean quoted) Description copied from class:JSONWriterWrites a string from character array with specified offset and length.- Specified by:
writeStringin classJSONWriter- Parameters:
str- the character array to writeoffset- the offset in the arraylen- the number of characters to writequoted- whether to quote the string
-
writeString
Description copied from class:JSONWriterWrites an array of strings as a JSON array. Each string in the array is written as a separate string value in the array.- Overrides:
writeStringin classJSONWriter- Parameters:
strings- the array of strings to write, can be null
-
writeReference
Description copied from class:JSONWriterWrites a reference to a previously serialized object. This is used for handling circular references and avoiding infinite loops during serialization.- Specified by:
writeReferencein classJSONWriter- Parameters:
path- the JSON Pointer path to the referenced object
-
writeBase64
public final void writeBase64(byte[] bytes) Description copied from class:JSONWriterWrites a byte array as Base64-encoded string.- Specified by:
writeBase64in classJSONWriter- Parameters:
bytes- the byte array to encode and write
-
writeHex
public final void writeHex(byte[] bytes) Description copied from class:JSONWriterWrites a byte array as hexadecimal string.- Specified by:
writeHexin classJSONWriter- Parameters:
bytes- the byte array to encode and write
-
writeBigInt
Description copied from class:JSONWriterWrites a BigInteger value using the specified features.- Specified by:
writeBigIntin classJSONWriter- Parameters:
value- the BigInteger value to write, can be nullfeatures- the features to use for serialization
-
writeDecimal
Description copied from class:JSONWriterWrites a BigDecimal value using the specified features and decimal format.- Specified by:
writeDecimalin classJSONWriter- Parameters:
value- the BigDecimal value to write, can be nullfeatures- the features to use for serializationformat- the decimal format to use, or null to use default formatting
-
writeUUID
Description copied from class:JSONWriterWrites a UUID value. The UUID is typically serialized as a string in standard UUID format.- Specified by:
writeUUIDin classJSONWriter- Parameters:
value- the UUID to write, can be null
-
writeRaw
Description copied from class:JSONWriterWrites a raw string without any escaping or formatting.- Specified by:
writeRawin classJSONWriter- Parameters:
str- the string to write
-
writeRaw
public final void writeRaw(char[] str, int coff, int strlen) Description copied from class:JSONWriterWrites raw characters without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Overrides:
writeRawin classJSONWriter- Parameters:
str- the character array to writecoff- the offset in the character arraystrlen- the number of characters to write
-
writeChar
public final void writeChar(char ch) Description copied from class:JSONWriterWrites a character without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeCharin classJSONWriter- Parameters:
ch- the character to write
-
writeRaw
public final void writeRaw(char ch) Description copied from class:JSONWriterWrites a raw character without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeRawin classJSONWriter- Parameters:
ch- the character to write
-
writeRaw
public final void writeRaw(char c0, char c1) Description copied from class:JSONWriterWrites two raw characters without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Overrides:
writeRawin classJSONWriter- Parameters:
c0- the first character to writec1- the second character to write
-
writeNameRaw
public final void writeNameRaw(char[] name) Description copied from class:JSONWriterWrites raw characters representing a field name without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeNameRawin classJSONWriter- Parameters:
name- the character array to write
-
writeName2Raw
public final void writeName2Raw(long name) Description copied from class:JSONWriterWrites a 2-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName2Rawin classJSONWriter- Parameters:
name- the 2-character field name as a long value
-
writeName3Raw
public final void writeName3Raw(long name) Description copied from class:JSONWriterWrites a 3-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName3Rawin classJSONWriter- Parameters:
name- the 3-character field name as a long value
-
writeName4Raw
public final void writeName4Raw(long name) Description copied from class:JSONWriterWrites a 4-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName4Rawin classJSONWriter- Parameters:
name- the 4-character field name as a long value
-
writeName5Raw
public final void writeName5Raw(long name) Description copied from class:JSONWriterWrites a 5-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName5Rawin classJSONWriter- Parameters:
name- the 5-character field name as a long value
-
writeName6Raw
public final void writeName6Raw(long name) Description copied from class:JSONWriterWrites a 6-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName6Rawin classJSONWriter- Parameters:
name- the 6-character field name as a long value
-
writeName7Raw
public final void writeName7Raw(long name) Description copied from class:JSONWriterWrites a 7-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName7Rawin classJSONWriter- Parameters:
name- the 7-character field name as a long value
-
writeName8Raw
public final void writeName8Raw(long name) Description copied from class:JSONWriterWrites an 8-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName8Rawin classJSONWriter- Parameters:
name- the 8-character field name as a long value
-
writeName9Raw
public final void writeName9Raw(long name0, int name1) Description copied from class:JSONWriterWrites a 9-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName9Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the 9th character of the field name as an integer value
-
writeName10Raw
public final void writeName10Raw(long name0, long name1) Description copied from class:JSONWriterWrites a 10-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName10Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 2 characters of the field name as a long value
-
writeName11Raw
public final void writeName11Raw(long name0, long name1) Description copied from class:JSONWriterWrites an 11-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName11Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 3 characters of the field name as a long value
-
writeName12Raw
public final void writeName12Raw(long name0, long name1) Description copied from class:JSONWriterWrites a 12-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName12Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 4 characters of the field name as a long value
-
writeName13Raw
public final void writeName13Raw(long name0, long name1) Description copied from class:JSONWriterWrites a 13-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName13Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 5 characters of the field name as a long value
-
writeName14Raw
public final void writeName14Raw(long name0, long name1) Description copied from class:JSONWriterWrites a 14-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName14Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 6 characters of the field name as a long value
-
writeName15Raw
public final void writeName15Raw(long name0, long name1) Description copied from class:JSONWriterWrites a 15-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName15Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 7 characters of the field name as a long value
-
writeName16Raw
public final void writeName16Raw(long name0, long name1) Description copied from class:JSONWriterWrites a 16-character field name as raw bytes without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeName16Rawin classJSONWriter- Parameters:
name0- the first 8 characters of the field name as a long valuename1- the last 8 characters of the field name as a long value
-
writeNameRaw
public final void writeNameRaw(char[] name, int coff, int len) Description copied from class:JSONWriterWrites raw characters representing a field name without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeNameRawin classJSONWriter- Parameters:
name- the character array to writecoff- the offset in the character arraylen- the number of characters to write
-
ensureCapacity
Description copied from class:JSONWriterEnsures that the internal buffer has at least the specified minimum capacity. This method is used to dynamically expand the buffer when more space is needed during the serialization process.- Specified by:
ensureCapacityin classJSONWriter- Parameters:
minCapacity- the minimum capacity required- Returns:
- the expanded buffer object
-
grow0
protected final void grow0(int minCapacity) -
writeInt32
public final void writeInt32(int[] value) Description copied from class:JSONWriterWrites an int array as integers.- Specified by:
writeInt32in classJSONWriter- Parameters:
value- the int array to write
-
writeInt8
public final void writeInt8(byte i) Description copied from class:JSONWriterWrites a byte value as an integer.- Specified by:
writeInt8in classJSONWriter- Parameters:
i- the byte value to write
-
writeInt8
public final void writeInt8(byte[] value) Description copied from class:JSONWriterWrites a byte array as integers.- Specified by:
writeInt8in classJSONWriter- Parameters:
value- the byte array to write
-
writeInt16
public final void writeInt16(short i) Description copied from class:JSONWriterWrites a short value as an integer.- Specified by:
writeInt16in classJSONWriter- Parameters:
i- the short value to write
-
writeInt32
public final void writeInt32(int i) Description copied from class:JSONWriterWrites an int value.- Specified by:
writeInt32in classJSONWriter- Parameters:
i- the int value to write
-
writeInt32
Description copied from class:JSONWriterWrites an Integer object.- Specified by:
writeInt32in classJSONWriter- Parameters:
i- the Integer object to write
-
writeInt64
public final void writeInt64(long[] values) Description copied from class:JSONWriterWrites a long array as integers.- Specified by:
writeInt64in classJSONWriter- Parameters:
values- the long array to write
-
writeListInt32
Description copied from class:JSONWriterWrites a list of Integer values as integers.- Specified by:
writeListInt32in classJSONWriter- Parameters:
values- the list of Integer values to write
-
writeListInt64
Description copied from class:JSONWriterWrites a list of Long values as integers.- Specified by:
writeListInt64in classJSONWriter- Parameters:
values- the list of Long values to write
-
writeInt64
public final void writeInt64(long i) Description copied from class:JSONWriterWrites a long value.- Specified by:
writeInt64in classJSONWriter- Parameters:
i- the long value to write
-
writeInt64
Description copied from class:JSONWriterWrites a Long object.- Specified by:
writeInt64in classJSONWriter- Parameters:
i- the Long object to write
-
writeFloat
public final void writeFloat(float value) Description copied from class:JSONWriterWrites a float value.- Specified by:
writeFloatin classJSONWriter- Parameters:
value- the float value to write
-
writeFloat
public final void writeFloat(float[] values) - Specified by:
writeFloatin classJSONWriter
-
writeDouble
public final void writeDouble(double value) Description copied from class:JSONWriterWrites a double value.- Specified by:
writeDoublein classJSONWriter- Parameters:
value- the double value to write
-
writeDoubleArray
public final void writeDoubleArray(double value0, double value1) Description copied from class:JSONWriterWrites a double array with two elements. This is a convenience method for writing arrays that contain exactly two double values.- Overrides:
writeDoubleArrayin classJSONWriter- Parameters:
value0- the first double value to writevalue1- the second double value to write
-
writeDouble
public final void writeDouble(double[] values) Description copied from class:JSONWriterWrites a double array as floating-point numbers.- Specified by:
writeDoublein classJSONWriter- Parameters:
values- the double array to write
-
writeDateTime14
public final void writeDateTime14(int year, int month, int dayOfMonth, int hour, int minute, int second) Description copied from class:JSONWriterWrites a date-time value in 14-character format (yyyyMMddHHmmss).- Specified by:
writeDateTime14in classJSONWriter- Parameters:
year- the yearmonth- the month (1-12)dayOfMonth- the day of month (1-31)hour- the hour (0-23)minute- the minute (0-59)second- the second (0-59)
-
writeDateTime19
public final void writeDateTime19(int year, int month, int dayOfMonth, int hour, int minute, int second) Description copied from class:JSONWriterWrites a date-time value in 19-character format (yyyy-MM-dd HH:mm:ss).- Specified by:
writeDateTime19in classJSONWriter- Parameters:
year- the yearmonth- the month (1-12)dayOfMonth- the day of month (1-31)hour- the hour (0-23)minute- the minute (0-59)second- the second (0-59)
-
writeLocalDate
Description copied from class:JSONWriterWrites a LocalDate value.- Specified by:
writeLocalDatein classJSONWriter- Parameters:
date- the LocalDate to write
-
writeLocalDateTime
Description copied from class:JSONWriterWrites a LocalDateTime value.- Specified by:
writeLocalDateTimein classJSONWriter- Parameters:
dateTime- the LocalDateTime to write
-
writeDateTimeISO8601
public final void writeDateTimeISO8601(int year, int month, int dayOfMonth, int hour, int minute, int second, int millis, int offsetSeconds, boolean timeZone) Description copied from class:JSONWriterWrites a date-time value in ISO8601 format.- Specified by:
writeDateTimeISO8601in classJSONWriter- Parameters:
year- the yearmonth- the month (1-12)dayOfMonth- the day of month (1-31)hour- the hour (0-23)minute- the minute (0-59)second- the second (0-59)millis- the millisecond (0-999)offsetSeconds- the timezone offset in secondstimeZone- whether to include timezone information
-
writeDateYYYMMDD8
public final void writeDateYYYMMDD8(int year, int month, int dayOfMonth) Description copied from class:JSONWriterWrites a date in 8-character format (yyyyMMdd).- Specified by:
writeDateYYYMMDD8in classJSONWriter- Parameters:
year- the yearmonth- the month (1-12)dayOfMonth- the day of month (1-31)
-
writeDateYYYMMDD10
public final void writeDateYYYMMDD10(int year, int month, int dayOfMonth) Description copied from class:JSONWriterWrites a date in 10-character format (yyyy-MM-dd).- Specified by:
writeDateYYYMMDD10in classJSONWriter- Parameters:
year- the yearmonth- the month (1-12)dayOfMonth- the day of month (1-31)
-
writeTimeHHMMSS8
public final void writeTimeHHMMSS8(int hour, int minute, int second) Description copied from class:JSONWriterWrites a time in 8-character format (HH:mm:ss).- Specified by:
writeTimeHHMMSS8in classJSONWriter- Parameters:
hour- the hour (0-23)minute- the minute (0-59)second- the second (0-59)
-
writeLocalTime
Description copied from class:JSONWriterWrites a LocalTime value.- Specified by:
writeLocalTimein classJSONWriter- Parameters:
time- the LocalTime to write
-
writeZonedDateTime
Description copied from class:JSONWriterWrites a ZonedDateTime value.- Specified by:
writeZonedDateTimein classJSONWriter- Parameters:
dateTime- the ZonedDateTime to write
-
writeOffsetDateTime
Description copied from class:JSONWriterWrites an OffsetDateTime value.- Specified by:
writeOffsetDateTimein classJSONWriter- Parameters:
dateTime- the OffsetDateTime to write
-
writeOffsetTime
Description copied from class:JSONWriterWrites an OffsetTime value.- Specified by:
writeOffsetTimein classJSONWriter- Parameters:
time- the OffsetTime to write
-
writeNameRaw
public final void writeNameRaw(byte[] bytes) Description copied from class:JSONWriterWrites raw bytes representing a field name without any escaping or formatting. This method is used for low-level output operations where no JSON formatting or escaping should be applied.- Specified by:
writeNameRawin classJSONWriter- Parameters:
bytes- the bytes to write
-
flushTo
Description copied from class:JSONWriterFlushes the content of this JSONWriter to the specified OutputStream. This method writes the current content directly to the provided OutputStream without converting to a string first.- Specified by:
flushToin classJSONWriter- Parameters:
out- the OutputStream to flush content to- Returns:
- the number of bytes written
- Throws:
IOException- if an I/O error occurs while writing to the OutputStream
-
flushTo
Description copied from class:JSONWriterFlushes the content of this JSONWriter to the specified OutputStream using the specified charset. This method writes the current content directly to the provided OutputStream using the specified charset for encoding.- Specified by:
flushToin classJSONWriter- Parameters:
out- the OutputStream to flush content tocharset- the charset to use for encoding- Returns:
- the number of bytes written
- Throws:
IOException- if an I/O error occurs while writing to the OutputStream
-
toString
-
getBytes
public final byte[] getBytes()Description copied from class:JSONWriterGets the content of the output buffer as a byte array.- Specified by:
getBytesin classJSONWriter- Returns:
- the content as a byte array
-
size
public final int size()Description copied from class:JSONWriterGets the current size of the output buffer.- Specified by:
sizein classJSONWriter- Returns:
- the size of the output buffer in bytes
-
getBytes
Description copied from class:JSONWriterGets the content of the output buffer as a byte array using the specified charset.- Specified by:
getBytesin classJSONWriter- Parameters:
charset- the charset to use for encoding- Returns:
- the content as a byte array
-
writeRaw
public final void writeRaw(byte[] bytes) Description copied from class:JSONWriterWrites raw bytes without any escaping or formatting.- Specified by:
writeRawin classJSONWriter- Parameters:
bytes- the bytes to write
-
write
Description copied from class:JSONWriterWrites a Map as a JSON object. Each entry in the map becomes a key-value pair in the JSON object. Null values are handled according to the WriteMapNullValue feature.- Overrides:
writein classJSONWriter- Parameters:
map- the Map to write, can be null
-
write
Description copied from class:JSONWriterWrites a list as a JSON array.- Specified by:
writein classJSONWriter- Parameters:
array- the list to write
-
writeString
public final void writeString(boolean value) Description copied from class:JSONWriterWrites a boolean value as a string.- Specified by:
writeStringin classJSONWriter- Parameters:
value- the boolean value to write
-
writeString
public final void writeString(byte value) Description copied from class:JSONWriterWrites a byte value as a string.- Specified by:
writeStringin classJSONWriter- Parameters:
value- the byte value to write
-
writeString
public final void writeString(short value) Description copied from class:JSONWriterWrites a short value as a string.- Specified by:
writeStringin classJSONWriter- Parameters:
value- the short value to write
-
writeString
public final void writeString(int value) Description copied from class:JSONWriterWrites an int value as a string.- Specified by:
writeStringin classJSONWriter- Parameters:
value- the int value to write
-
writeString
public final void writeString(long value) Description copied from class:JSONWriterWrites a long value as a string.- Specified by:
writeStringin classJSONWriter- Parameters:
value- the long value to write
-
writeString
public final void writeString(char[] value) Description copied from class:JSONWriterWrites a string from character array.- Specified by:
writeStringin classJSONWriter- Parameters:
value- the character array to write
-
writeString
public final void writeString(char[] str, int coff, int len) Description copied from class:JSONWriterWrites a string from character array with specified offset and length.- Specified by:
writeStringin classJSONWriter- Parameters:
str- the character array to writecoff- the offset in the arraylen- the number of characters to write
-
writeBool
public void writeBool(boolean value) Description copied from class:JSONWriterWrites a boolean value.- Specified by:
writeBoolin classJSONWriter- Parameters:
value- the boolean value to write
-