Class JSONWriterUTF16JDK8UF

java.lang.Object
com.alibaba.fastjson2.JSONWriter
com.alibaba.fastjson2.JSONWriterUTF16JDK8UF
All Implemented Interfaces:
Closeable, AutoCloseable

public final class JSONWriterUTF16JDK8UF extends JSONWriter
  • Field Details

    • chars

      protected char[] chars
    • byteVectorQuote

      protected final long byteVectorQuote
  • Method Details

    • writeString

      public void writeString(String str)
      Description copied from class: JSONWriter
      Writes a string value.
      Parameters:
      str - the string to write, can be null
    • writeNull

      public final void writeNull()
      Description copied from class: JSONWriter
      Writes a null value.
      Specified by:
      writeNull in class JSONWriter
    • flushTo

      public final void flushTo(Writer to)
      Description copied from class: JSONWriter
      Flushes 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:
      flushTo in class JSONWriter
      Parameters:
      to - the Writer to flush content to
    • close

      public final void close()
      Description copied from class: JSONWriter
      Closes 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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class JSONWriter
    • write0

      protected final void write0(char c)
      Description copied from class: JSONWriter
      Writes a character to the output.
      Specified by:
      write0 in class JSONWriter
      Parameters:
      c - the character to write
    • writeColon

      public final void writeColon()
      Description copied from class: JSONWriter
      Writes a colon separator.
      Specified by:
      writeColon in class JSONWriter
    • startObject

      public final void startObject()
      Description copied from class: JSONWriter
      Starts writing a JSON object. This method writes the opening brace '{' and prepares the writer for writing key-value pairs.
      Specified by:
      startObject in class JSONWriter
    • endObject

      public final void endObject()
      Description copied from class: JSONWriter
      Ends writing a JSON object. This method writes the closing brace '}' and completes the current object.
      Specified by:
      endObject in class JSONWriter
    • writeComma

      public final void writeComma()
      Description copied from class: JSONWriter
      Writes a comma separator.
      Specified by:
      writeComma in class JSONWriter
    • startArray

      public final void startArray()
      Description copied from class: JSONWriter
      Starts writing a JSON array. This method writes the opening bracket '[' and prepares the writer for writing array elements.
      Specified by:
      startArray in class JSONWriter
    • endArray

      public final void endArray()
      Description copied from class: JSONWriter
      Ends the current JSON array.
      Specified by:
      endArray in class JSONWriter
    • writeString

      public final void writeString(List<String> list)
      Description copied from class: JSONWriter
      Writes a list of strings as a JSON array. Each string in the list is written as a separate string value in the array.
      Overrides:
      writeString in class JSONWriter
      Parameters:
      list - the list of strings to write, can be null
    • writeStringLatin1

      public void writeStringLatin1(byte[] value)
      Description copied from class: JSONWriter
      Writes a string from Latin-1 encoded bytes.
      Specified by:
      writeStringLatin1 in class JSONWriter
      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: JSONWriter
      Writes a string from UTF-16 encoded bytes.
      Specified by:
      writeStringUTF16 in class JSONWriter
      Parameters:
      value - the UTF-16 encoded bytes to write
    • writeStringEscape

      protected final void writeStringEscape(String str)
    • 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: JSONWriter
      Writes a string from character array with specified offset and length.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      str - the character array to write
      offset - the offset in the array
      len - the number of characters to write
      quoted - whether to quote the string
    • writeString

      public final void writeString(String[] strings)
      Description copied from class: JSONWriter
      Writes an array of strings as a JSON array. Each string in the array is written as a separate string value in the array.
      Overrides:
      writeString in class JSONWriter
      Parameters:
      strings - the array of strings to write, can be null
    • writeReference

      public final void writeReference(String path)
      Description copied from class: JSONWriter
      Writes a reference to a previously serialized object. This is used for handling circular references and avoiding infinite loops during serialization.
      Specified by:
      writeReference in class JSONWriter
      Parameters:
      path - the JSON Pointer path to the referenced object
    • writeBase64

      public final void writeBase64(byte[] bytes)
      Description copied from class: JSONWriter
      Writes a byte array as Base64-encoded string.
      Specified by:
      writeBase64 in class JSONWriter
      Parameters:
      bytes - the byte array to encode and write
    • writeHex

      public final void writeHex(byte[] bytes)
      Description copied from class: JSONWriter
      Writes a byte array as hexadecimal string.
      Specified by:
      writeHex in class JSONWriter
      Parameters:
      bytes - the byte array to encode and write
    • writeBigInt

      public final void writeBigInt(BigInteger value, long features)
      Description copied from class: JSONWriter
      Writes a BigInteger value using the specified features.
      Specified by:
      writeBigInt in class JSONWriter
      Parameters:
      value - the BigInteger value to write, can be null
      features - the features to use for serialization
    • writeDecimal

      public final void writeDecimal(BigDecimal value, long features, DecimalFormat format)
      Description copied from class: JSONWriter
      Writes a BigDecimal value using the specified features and decimal format.
      Specified by:
      writeDecimal in class JSONWriter
      Parameters:
      value - the BigDecimal value to write, can be null
      features - the features to use for serialization
      format - the decimal format to use, or null to use default formatting
    • writeUUID

      public final void writeUUID(UUID value)
      Description copied from class: JSONWriter
      Writes a UUID value. The UUID is typically serialized as a string in standard UUID format.
      Specified by:
      writeUUID in class JSONWriter
      Parameters:
      value - the UUID to write, can be null
    • writeRaw

      public final void writeRaw(String str)
      Description copied from class: JSONWriter
      Writes a raw string without any escaping or formatting.
      Specified by:
      writeRaw in class JSONWriter
      Parameters:
      str - the string to write
    • writeRaw

      public final void writeRaw(char[] str, int coff, int strlen)
      Description copied from class: JSONWriter
      Writes 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:
      writeRaw in class JSONWriter
      Parameters:
      str - the character array to write
      coff - the offset in the character array
      strlen - the number of characters to write
    • writeChar

      public final void writeChar(char ch)
      Description copied from class: JSONWriter
      Writes 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:
      writeChar in class JSONWriter
      Parameters:
      ch - the character to write
    • writeRaw

      public final void writeRaw(char ch)
      Description copied from class: JSONWriter
      Writes 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:
      writeRaw in class JSONWriter
      Parameters:
      ch - the character to write
    • writeRaw

      public final void writeRaw(char c0, char c1)
      Description copied from class: JSONWriter
      Writes 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:
      writeRaw in class JSONWriter
      Parameters:
      c0 - the first character to write
      c1 - the second character to write
    • writeNameRaw

      public final void writeNameRaw(char[] name)
      Description copied from class: JSONWriter
      Writes 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:
      writeNameRaw in class JSONWriter
      Parameters:
      name - the character array to write
    • writeName2Raw

      public final void writeName2Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName2Raw in class JSONWriter
      Parameters:
      name - the 2-character field name as a long value
    • writeName3Raw

      public final void writeName3Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName3Raw in class JSONWriter
      Parameters:
      name - the 3-character field name as a long value
    • writeName4Raw

      public final void writeName4Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName4Raw in class JSONWriter
      Parameters:
      name - the 4-character field name as a long value
    • writeName5Raw

      public final void writeName5Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName5Raw in class JSONWriter
      Parameters:
      name - the 5-character field name as a long value
    • writeName6Raw

      public final void writeName6Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName6Raw in class JSONWriter
      Parameters:
      name - the 6-character field name as a long value
    • writeName7Raw

      public final void writeName7Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName7Raw in class JSONWriter
      Parameters:
      name - the 7-character field name as a long value
    • writeName8Raw

      public final void writeName8Raw(long name)
      Description copied from class: JSONWriter
      Writes 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:
      writeName8Raw in class JSONWriter
      Parameters:
      name - the 8-character field name as a long value
    • writeName9Raw

      public final void writeName9Raw(long name0, int name1)
      Description copied from class: JSONWriter
      Writes 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:
      writeName9Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - the 9th character of the field name as an integer value
    • writeName10Raw

      public final void writeName10Raw(long name0, long name1)
      Description copied from class: JSONWriter
      Writes 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:
      writeName10Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeName11Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeName12Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeName13Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeName14Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeName15Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeName16Raw in class JSONWriter
      Parameters:
      name0 - the first 8 characters of the field name as a long value
      name1 - 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: JSONWriter
      Writes 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:
      writeNameRaw in class JSONWriter
      Parameters:
      name - the character array to write
      coff - the offset in the character array
      len - the number of characters to write
    • ensureCapacity

      public final Object ensureCapacity(int minCapacity)
      Description copied from class: JSONWriter
      Ensures 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:
      ensureCapacity in class JSONWriter
      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: JSONWriter
      Writes an int array as integers.
      Specified by:
      writeInt32 in class JSONWriter
      Parameters:
      value - the int array to write
    • writeInt8

      public final void writeInt8(byte i)
      Description copied from class: JSONWriter
      Writes a byte value as an integer.
      Specified by:
      writeInt8 in class JSONWriter
      Parameters:
      i - the byte value to write
    • writeInt8

      public final void writeInt8(byte[] value)
      Description copied from class: JSONWriter
      Writes a byte array as integers.
      Specified by:
      writeInt8 in class JSONWriter
      Parameters:
      value - the byte array to write
    • writeInt16

      public final void writeInt16(short i)
      Description copied from class: JSONWriter
      Writes a short value as an integer.
      Specified by:
      writeInt16 in class JSONWriter
      Parameters:
      i - the short value to write
    • writeInt32

      public final void writeInt32(int i)
      Description copied from class: JSONWriter
      Writes an int value.
      Specified by:
      writeInt32 in class JSONWriter
      Parameters:
      i - the int value to write
    • writeInt32

      public final void writeInt32(Integer i)
      Description copied from class: JSONWriter
      Writes an Integer object.
      Specified by:
      writeInt32 in class JSONWriter
      Parameters:
      i - the Integer object to write
    • writeInt64

      public final void writeInt64(long[] values)
      Description copied from class: JSONWriter
      Writes a long array as integers.
      Specified by:
      writeInt64 in class JSONWriter
      Parameters:
      values - the long array to write
    • writeListInt32

      public final void writeListInt32(List<Integer> values)
      Description copied from class: JSONWriter
      Writes a list of Integer values as integers.
      Specified by:
      writeListInt32 in class JSONWriter
      Parameters:
      values - the list of Integer values to write
    • writeListInt64

      public final void writeListInt64(List<Long> values)
      Description copied from class: JSONWriter
      Writes a list of Long values as integers.
      Specified by:
      writeListInt64 in class JSONWriter
      Parameters:
      values - the list of Long values to write
    • writeInt64

      public final void writeInt64(long i)
      Description copied from class: JSONWriter
      Writes a long value.
      Specified by:
      writeInt64 in class JSONWriter
      Parameters:
      i - the long value to write
    • writeInt64

      public final void writeInt64(Long i)
      Description copied from class: JSONWriter
      Writes a Long object.
      Specified by:
      writeInt64 in class JSONWriter
      Parameters:
      i - the Long object to write
    • writeFloat

      public final void writeFloat(float value)
      Description copied from class: JSONWriter
      Writes a float value.
      Specified by:
      writeFloat in class JSONWriter
      Parameters:
      value - the float value to write
    • writeFloat

      public final void writeFloat(float[] values)
      Specified by:
      writeFloat in class JSONWriter
    • writeDouble

      public final void writeDouble(double value)
      Description copied from class: JSONWriter
      Writes a double value.
      Specified by:
      writeDouble in class JSONWriter
      Parameters:
      value - the double value to write
    • writeDoubleArray

      public final void writeDoubleArray(double value0, double value1)
      Description copied from class: JSONWriter
      Writes a double array with two elements. This is a convenience method for writing arrays that contain exactly two double values.
      Overrides:
      writeDoubleArray in class JSONWriter
      Parameters:
      value0 - the first double value to write
      value1 - the second double value to write
    • writeDouble

      public final void writeDouble(double[] values)
      Description copied from class: JSONWriter
      Writes a double array as floating-point numbers.
      Specified by:
      writeDouble in class JSONWriter
      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: JSONWriter
      Writes a date-time value in 14-character format (yyyyMMddHHmmss).
      Specified by:
      writeDateTime14 in class JSONWriter
      Parameters:
      year - the year
      month - 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: JSONWriter
      Writes a date-time value in 19-character format (yyyy-MM-dd HH:mm:ss).
      Specified by:
      writeDateTime19 in class JSONWriter
      Parameters:
      year - the year
      month - 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

      public final void writeLocalDate(LocalDate date)
      Description copied from class: JSONWriter
      Writes a LocalDate value.
      Specified by:
      writeLocalDate in class JSONWriter
      Parameters:
      date - the LocalDate to write
    • writeLocalDateTime

      public final void writeLocalDateTime(LocalDateTime dateTime)
      Description copied from class: JSONWriter
      Writes a LocalDateTime value.
      Specified by:
      writeLocalDateTime in class JSONWriter
      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: JSONWriter
      Writes a date-time value in ISO8601 format.
      Specified by:
      writeDateTimeISO8601 in class JSONWriter
      Parameters:
      year - the year
      month - 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 seconds
      timeZone - whether to include timezone information
    • writeDateYYYMMDD8

      public final void writeDateYYYMMDD8(int year, int month, int dayOfMonth)
      Description copied from class: JSONWriter
      Writes a date in 8-character format (yyyyMMdd).
      Specified by:
      writeDateYYYMMDD8 in class JSONWriter
      Parameters:
      year - the year
      month - 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: JSONWriter
      Writes a date in 10-character format (yyyy-MM-dd).
      Specified by:
      writeDateYYYMMDD10 in class JSONWriter
      Parameters:
      year - the year
      month - 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: JSONWriter
      Writes a time in 8-character format (HH:mm:ss).
      Specified by:
      writeTimeHHMMSS8 in class JSONWriter
      Parameters:
      hour - the hour (0-23)
      minute - the minute (0-59)
      second - the second (0-59)
    • writeLocalTime

      public final void writeLocalTime(LocalTime time)
      Description copied from class: JSONWriter
      Writes a LocalTime value.
      Specified by:
      writeLocalTime in class JSONWriter
      Parameters:
      time - the LocalTime to write
    • writeZonedDateTime

      public final void writeZonedDateTime(ZonedDateTime dateTime)
      Description copied from class: JSONWriter
      Writes a ZonedDateTime value.
      Specified by:
      writeZonedDateTime in class JSONWriter
      Parameters:
      dateTime - the ZonedDateTime to write
    • writeOffsetDateTime

      public final void writeOffsetDateTime(OffsetDateTime dateTime)
      Description copied from class: JSONWriter
      Writes an OffsetDateTime value.
      Specified by:
      writeOffsetDateTime in class JSONWriter
      Parameters:
      dateTime - the OffsetDateTime to write
    • writeOffsetTime

      public final void writeOffsetTime(OffsetTime time)
      Description copied from class: JSONWriter
      Writes an OffsetTime value.
      Specified by:
      writeOffsetTime in class JSONWriter
      Parameters:
      time - the OffsetTime to write
    • writeNameRaw

      public final void writeNameRaw(byte[] bytes)
      Description copied from class: JSONWriter
      Writes 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:
      writeNameRaw in class JSONWriter
      Parameters:
      bytes - the bytes to write
    • flushTo

      public final int flushTo(OutputStream out) throws IOException
      Description copied from class: JSONWriter
      Flushes 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:
      flushTo in class JSONWriter
      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

      public final int flushTo(OutputStream out, Charset charset) throws IOException
      Description copied from class: JSONWriter
      Flushes 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:
      flushTo in class JSONWriter
      Parameters:
      out - the OutputStream to flush content to
      charset - 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

      public final String toString()
      Overrides:
      toString in class Object
    • getBytes

      public final byte[] getBytes()
      Description copied from class: JSONWriter
      Gets the content of the output buffer as a byte array.
      Specified by:
      getBytes in class JSONWriter
      Returns:
      the content as a byte array
    • size

      public final int size()
      Description copied from class: JSONWriter
      Gets the current size of the output buffer.
      Specified by:
      size in class JSONWriter
      Returns:
      the size of the output buffer in bytes
    • getBytes

      public final byte[] getBytes(Charset charset)
      Description copied from class: JSONWriter
      Gets the content of the output buffer as a byte array using the specified charset.
      Specified by:
      getBytes in class JSONWriter
      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: JSONWriter
      Writes raw bytes without any escaping or formatting.
      Specified by:
      writeRaw in class JSONWriter
      Parameters:
      bytes - the bytes to write
    • write

      public final void write(Map<?,?> map)
      Description copied from class: JSONWriter
      Writes 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:
      write in class JSONWriter
      Parameters:
      map - the Map to write, can be null
    • write

      public final void write(List array)
      Description copied from class: JSONWriter
      Writes a list as a JSON array.
      Specified by:
      write in class JSONWriter
      Parameters:
      array - the list to write
    • writeString

      public final void writeString(boolean value)
      Description copied from class: JSONWriter
      Writes a boolean value as a string.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      value - the boolean value to write
    • writeString

      public final void writeString(byte value)
      Description copied from class: JSONWriter
      Writes a byte value as a string.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      value - the byte value to write
    • writeString

      public final void writeString(short value)
      Description copied from class: JSONWriter
      Writes a short value as a string.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      value - the short value to write
    • writeString

      public final void writeString(int value)
      Description copied from class: JSONWriter
      Writes an int value as a string.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      value - the int value to write
    • writeString

      public final void writeString(long value)
      Description copied from class: JSONWriter
      Writes a long value as a string.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      value - the long value to write
    • writeString

      public final void writeString(char[] value)
      Description copied from class: JSONWriter
      Writes a string from character array.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      value - the character array to write
    • writeString

      public final void writeString(char[] str, int coff, int len)
      Description copied from class: JSONWriter
      Writes a string from character array with specified offset and length.
      Specified by:
      writeString in class JSONWriter
      Parameters:
      str - the character array to write
      coff - the offset in the array
      len - the number of characters to write
    • writeBool

      public void writeBool(boolean value)
      Description copied from class: JSONWriter
      Writes a boolean value.
      Specified by:
      writeBool in class JSONWriter
      Parameters:
      value - the boolean value to write