package core
- Alphabetic
- By Inheritance
- core
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
JsonCodec[A] extends JsonValueCodec[A] with JsonKeyCodec[A]
A
JsonCodec[A]instance is a universal codec for JSON values and keys. -
trait
JsonKeyCodec[A] extends Serializable
A
JsonKeyCodec[A]instance has the ability to decode and encode JSON keys to/from values of typeA, potentially failing with an error if the JSON input is not a key or does not encode a value of the given type orAcannot be encoded properly according to RFC-8259 requirements. - final class JsonReader extends AnyRef
- class JsonReaderException extends RuntimeException
-
trait
JsonValueCodec[A] extends Serializable
A
JsonValueCodec[A]instance has the ability to decode and encode JSON values to/from values of typeA, potentially failing with an error if the JSON content does not encode a value of the given type orAcannot be encoded properly according to RFC-8259 requirements. - final class JsonWriter extends AnyRef
- class JsonWriterException extends RuntimeException
-
class
ReaderConfig extends Serializable
Configuration for com.github.plokhotnyuk.jsoniter_scala.core.JsonReader that contains flags for tuning of parsing exceptions and preferred sizes for internal buffers that are created on the reader instantiation and reused in runtime for parsing of messages.
Configuration for com.github.plokhotnyuk.jsoniter_scala.core.JsonReader that contains flags for tuning of parsing exceptions and preferred sizes for internal buffers that are created on the reader instantiation and reused in runtime for parsing of messages.
All configuration params already initialized by recommended default values, but in some cases they should be altered for performance reasons:- turn off stack traces for parsing exceptions to greatly reduce impact on performance for cases when exceptions can be not exceptional (e.g. under DoS attacks over open to the world systems), see more details here: https://shipilev.net/blog/2014/exceptional-performance/
- turn off appending of hex dump to minimize length of exception message
- increase preferred size of an internal byte buffer for parsing from java.io.InputStream or java.nio.DirectByteBuffer to reduce allocation rate of grown and then reduced buffers during parsing of large (>16Kb) numbers (including stringified), raw values, or ADT instances with the discriminator field doesn't appear in the beginning of the JSON object
- increase preferred size of an internal char buffer to reduce allocation rate of grown and then reduced buffers when large (>4Kb) string instances need to be parsed including those one which use Base16 or Base64 encodings
-
class
WriterConfig extends Serializable
Configuration for com.github.plokhotnyuk.jsoniter_scala.core.JsonWriter that contains params for formatting of output JSON and for tuning of preferred size for internal byte buffer that is created on the writer instantiation and reused in runtime for serialization of messages using java.io.OutputStream or java.nio.DirectByteBuffer.
Configuration for com.github.plokhotnyuk.jsoniter_scala.core.JsonWriter that contains params for formatting of output JSON and for tuning of preferred size for internal byte buffer that is created on the writer instantiation and reused in runtime for serialization of messages using java.io.OutputStream or java.nio.DirectByteBuffer.
All configuration params already initialized to default values, but in some cases they should be altered:- turn on pretty printing by specifying of indention step that is greater than 0
- turn on escaping of Unicode characters to serialize with only ASCII characters
- increase preferred size of an internal byte buffer to reduce allocation rate of grown and then reduced buffers
when writing to java.io.OutputStream or java.nio.DirectByteBuffer lot of large (>16Kb)
scala.math.BigDecimal, scala.math.BigInt or other non escaped ASCII strings written using
JsonWriter.writeNonEscapedAsciiKeyorJsonWriter.writeNonEscapedAsciiVal
Value Members
-
def
readFromArray[A](buf: Array[Byte], config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.- A
type of the value to parse
- buf
the byte array to parse from
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also in case if end of input is detected while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,buforconfigis null
-
def
readFromArrayReentrant[A](buf: Array[Byte], config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.While it is less efficient than parsing from a byte array using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- buf
the byte array to parse from
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also in case if end of input is detected while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,buforconfigis null
-
def
readFromByteBuffer[A](bbuf: ByteBuffer, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from a byte buffer into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from a byte buffer into a value of given
Atype.Parsing will start from the current position and will continue until the limit of the provided byte buffer or the value will be parsed before reaching of the limit. In any case the buffer position will be set to the next position after the last read byte.
- A
type of the value to parse
- bbuf
the byte buffer which will be parsed
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for the result type, also in case if end of input is detected while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,bbuforconfigis null
-
def
readFromByteBufferReentrant[A](bbuf: ByteBuffer, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from a byte buffer into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from a byte buffer into a value of given
Atype.Parsing will start from the current position and will continue until the limit of the provided byte buffer or the value will be parsed before reaching of the limit. In any case the buffer position will be set to the next position after the last read byte.
While it is less efficient than parsing from a byte buffer using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- bbuf
the byte buffer which will be parsed
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for the result type, also in case if end of input is detected while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,bbuforconfigis null
-
def
readFromStream[A](in: InputStream, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from an input stream into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from an input stream into a value of given
Atype.BEWARE: It is a non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of the value to parse
- in
the input stream to parse from
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also if a low-level I/O problem (unexpected end-of-input, network error) occurs while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,inorconfigis null
-
def
readFromStreamReentrant[A](in: InputStream, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from an input stream into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from an input stream into a value of given
Atype.While it is less efficient than scanning JSON values from an input stream using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- in
the input stream to parse from
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also if a low-level I/O problem (unexpected end-of-input, network error) occurs while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,inorconfigis null
-
def
readFromString[A](s: String, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content from a string into a value of given
Atype.Deserialize JSON content from a string into a value of given
Atype.- A
type of the value to parse
- s
a value of string which will be parsed
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains invalid JSON content or the input JSON structure does not match structure that expected for the result type, also in case if end of input is detected while some input characters are expectedjava.lang.NullPointerExceptionif any ofcodec,sorconfigis null
-
def
readFromStringReentrant[A](s: String, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content from a string into a value of given
Atype.Deserialize JSON content from a string into a value of given
Atype.While it is less efficient than parsing from a string using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- s
a value of string which will be parsed
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains invalid JSON content or the input JSON structure does not match structure that expected for the result type, also in case if end of input is detected while some input characters are expectedjava.lang.NullPointerExceptionif any ofcodec,sorconfigis null
-
def
readFromSubArray[A](buf: Array[Byte], from: Int, to: Int, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.- A
type of the value to parse
- buf
the byte array to parse from
- from
the start position of the provided byte array
- to
the position of end of input in the provided byte array
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also in case if end of input is detected while some input bytes are expectedjava.lang.ArrayIndexOutOfBoundsExceptionif thetois greater thanbuflength or negative, orfromis greater thantoor negativejava.lang.NullPointerExceptionif any ofcodec,buforconfigis null
-
def
readFromSubArrayReentrant[A](buf: Array[Byte], from: Int, to: Int, config: ReaderConfig = ReaderConfig)(implicit codec: JsonValueCodec[A]): A
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.Deserialize JSON content encoded in UTF-8 from a byte array into a value of given
Atype.While it is less efficient than parsing from a sub array using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- buf
the byte array to parse from
- from
the start position of the provided byte array
- to
the position of end of input in the provided byte array
- config
a parsing configuration
- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also in case if end of input is detected while some input bytes are expectedjava.lang.ArrayIndexOutOfBoundsExceptionif thetois greater thanbuflength or negative, orfromis greater thantoor negativejava.lang.NullPointerExceptionif any ofcodec,buforconfigis null
-
def
scanJsonArrayFromStream[A](in: InputStream, config: ReaderConfig = ReaderConfig)(f: (A) ⇒ Boolean)(implicit codec: JsonValueCodec[A]): Unit
Deserialize JSON array encoded in UTF-8 from an input stream into its values of given
Atype.Deserialize JSON array encoded in UTF-8 from an input stream into its values of given
Atype.All parsed values will be passed to consuming function
f.- A
type of the value to parse
- in
the input stream to parse from
- config
a parsing configuration
- f
a consumer of values, that returns
trueto continue scanning orfalseto complete it- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also if a low-level I/O problem (unexpected end-of-input, network error) occurs while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,inorconfigis nulljava.lang.Throwableif some error was thrown by f() call
-
def
scanJsonArrayFromStreamReentrant[A](in: InputStream, config: ReaderConfig = ReaderConfig)(f: (A) ⇒ Boolean)(implicit codec: JsonValueCodec[A]): Unit
Deserialize JSON array encoded in UTF-8 from an input stream into its values of given
Atype.Deserialize JSON array encoded in UTF-8 from an input stream into its values of given
Atype.All parsed values will be passed to consuming function
f.While it is less efficient than scanning JSON array from an input stream using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- in
the input stream to parse from
- config
a parsing configuration
- f
a consumer of values, that returns
trueto continue scanning orfalseto complete it- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also if a low-level I/O problem (unexpected end-of-input, network error) occurs while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,inorconfigis nulljava.lang.Throwableif some error was thrown by f() call
-
def
scanJsonValuesFromStream[A](in: InputStream, config: ReaderConfig = ReaderConfig)(f: (A) ⇒ Boolean)(implicit codec: JsonValueCodec[A]): Unit
Deserialize JSON of streaming values encoded in UTF-8 from an input stream into values of given
Atype.Deserialize JSON of streaming values encoded in UTF-8 from an input stream into values of given
Atype.All parsed values will be passed to consuming function
f.BEWARE: It is a non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of the value to parse
- in
the input stream to parse from
- config
a parsing configuration
- f
a consumer of values, that returns
trueto continue scanning orfalseto complete it- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also if a low-level I/O problem (unexpected end-of-input, network error) occurs while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,inorconfigis nulljava.lang.Throwableif some error was thrown by f() call
-
def
scanJsonValuesFromStreamReentrant[A](in: InputStream, config: ReaderConfig = ReaderConfig)(f: (A) ⇒ Boolean)(implicit codec: JsonValueCodec[A]): Unit
Deserialize JSON of streaming values encoded in UTF-8 from an input stream into values of given
Atype.Deserialize JSON of streaming values encoded in UTF-8 from an input stream into values of given
Atype.All parsed values will be passed to consuming function
f.While it is less efficient than scanning JSON values from an input stream using pooled readers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of the value to parse
- in
the input stream to parse from
- config
a parsing configuration
- f
a consumer of values, that returns
trueto continue scanning orfalseto complete it- codec
a codec for the given
Atype- returns
a successfully parsed value
- Exceptions thrown
JsonReaderExceptionif underlying input contains malformed UTF-8 bytes, invalid JSON content or the input JSON structure does not match structure that expected for result type, also if a low-level I/O problem (unexpected end-of-input, network error) occurs while some input bytes are expectedjava.lang.NullPointerExceptionif any ofcodec,inorconfigis nulljava.lang.Throwableif some error was thrown by f() call
-
def
writeToArray[A](x: A, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Array[Byte]
Serialize the
xargument to a new allocated instance of byte array in UTF-8 encoding of JSON format.Serialize the
xargument to a new allocated instance of byte array in UTF-8 encoding of JSON format.BEWARE: It is a non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of value to serialize
- x
the value to serialize
- config
a serialization configuration
- codec
a codec for the given value
- returns
a byte array with
xserialized to JSON
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.NullPointerExceptionif any ofx,codecorconfigis null
-
def
writeToArrayReentrant[A](x: A, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Array[Byte]
Serialize the
xargument to a new allocated instance of byte array in UTF-8 encoding of JSON format.Serialize the
xargument to a new allocated instance of byte array in UTF-8 encoding of JSON format.While it is less efficient than serialization to a byte array using pooled writers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of value to serialize
- x
the value to serialize
- config
a serialization configuration
- codec
a codec for the given value
- returns
a byte array with
xserialized to JSON
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.NullPointerExceptionif any ofx,codecorconfigis null
-
def
writeToByteBuffer[A](x: A, bbuf: ByteBuffer, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Unit
Serialize the
xargument to the given instance of byte buffer in UTF-8 encoding of JSON format.Serialize the
xargument to the given instance of byte buffer in UTF-8 encoding of JSON format.Serialization will start from the current position up to the provided byte buffer limit. On return the byte buffer will has position set to the next position after the last written byte.
BEWARE: It is a non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of value to serialize
- x
the value to serialize
- bbuf
a byte buffer where the value should be serialized
- config
a serialization configuration
- codec
a codec for the given value
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.NullPointerExceptionif any ofx,codec,bbuforconfigis nulljava.nio.BufferOverflowExceptionif thebbuflimit was exceeded during serializationjava.nio.ReadOnlyBufferExceptionif thebbufis read-only
-
def
writeToByteBufferReentrant[A](x: A, bbuf: ByteBuffer, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Unit
Serialize the
xargument to the given instance of byte buffer in UTF-8 encoding of JSON format.Serialize the
xargument to the given instance of byte buffer in UTF-8 encoding of JSON format.Serialization will start from the current position up to the provided byte buffer limit. On return the byte buffer will has position set to the next position after the last written byte.
While it is less efficient than serialization to a byte buffer pooled writers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of value to serialize
- x
the value to serialize
- bbuf
a byte buffer where the value should be serialized
- config
a serialization configuration
- codec
a codec for the given value
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.NullPointerExceptionif any ofx,codec,bbuforconfigis nulljava.nio.BufferOverflowExceptionif thebbuflimit was exceeded during serializationjava.nio.ReadOnlyBufferExceptionif thebbufis read-only
-
def
writeToStream[A](x: A, out: OutputStream, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Unit
Serialize the
xargument to the provided output stream in UTF-8 encoding of JSON format.Serialize the
xargument to the provided output stream in UTF-8 encoding of JSON format.BEWARE: It is a non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of value to serialize
- x
the value to serialize
- out
an output stream to serialize into
- config
a serialization configuration
- codec
a codec for the given value
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.io.IOExceptionif an I/O error occurs in a call to output streamjava.lang.NullPointerExceptionif any ofx,codec,outorconfigis null
-
def
writeToStreamReentrant[A](x: A, out: OutputStream, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Unit
Serialize the
xargument to the provided output stream in UTF-8 encoding of JSON format.Serialize the
xargument to the provided output stream in UTF-8 encoding of JSON format.While it is less efficient than serialization to an output stream using pooled writers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of value to serialize
- x
the value to serialize
- out
an output stream to serialize into
- config
a serialization configuration
- codec
a codec for the given value
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.io.IOExceptionif an I/O error occurs in a call to output streamjava.lang.NullPointerExceptionif any ofx,codec,outorconfigis null
-
def
writeToString[A](x: A, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): String
Serialize the
xargument to a string in JSON format.Serialize the
xargument to a string in JSON format.BEWARE: It is a non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of value to serialize
- x
the value to serialize
- config
a serialization configuration
- codec
a codec for the given value
- returns
a string with
xserialized to JSON
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.NullPointerExceptionif any ofx,codecorconfigis null
-
def
writeToStringReentrant[A](x: A, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): String
Serialize the
xargument to a string in JSON format.Serialize the
xargument to a string in JSON format.While it is less efficient than serialization to a string using pooled writers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of value to serialize
- x
the value to serialize
- config
a serialization configuration
- codec
a codec for the given value
- returns
a string with
xserialized to JSON
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.NullPointerExceptionif any ofx,codecorconfigis null
-
def
writeToSubArray[A](x: A, buf: Array[Byte], from: Int, to: Int, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Int
Serialize the
xargument to the given instance of byte array in UTF-8 encoding of JSON format.Serialize the
xargument to the given instance of byte array in UTF-8 encoding of JSON format.BEWARE: It is non-reentrant routine and should not be used in a nested way in the same thread.
- A
type of value to serialize
- x
the value to serialize
- buf
a byte array where the value should be serialized
- from
a position in the byte array from which serialization of the value should start
- to
an exclusive position in the byte array that limits where serialization of the value should stop
- config
a serialization configuration
- codec
a codec for the given value
- returns
number of next position after last byte serialized to
buf
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.ArrayIndexOutOfBoundsExceptionif thefromis greater thantoor negative, if 'to' is greater thanbuflength ortolimit was exceeded during serializationjava.lang.NullPointerExceptionif any ofx,codec,buforconfigis null
-
def
writeToSubArrayReentrant[A](x: A, buf: Array[Byte], from: Int, to: Int, config: WriterConfig = WriterConfig)(implicit codec: JsonValueCodec[A]): Int
Serialize the
xargument to the given instance of byte array in UTF-8 encoding of JSON format.Serialize the
xargument to the given instance of byte array in UTF-8 encoding of JSON format.While it is less efficient than serialization to a sub array using pooled writers but it can be safely used when a non-reentrant call is used in the same thread stack.
- A
type of value to serialize
- x
the value to serialize
- buf
a byte array where the value should be serialized
- from
a position in the byte array from which serialization of the value should start
- to
an exclusive position in the byte array that limits where serialization of the value should stop
- config
a serialization configuration
- codec
a codec for the given value
- returns
number of next position after last byte serialized to
buf
- Exceptions thrown
JsonWriterExceptionif the value to serialize contains strings, double or float values which cannot be properly encodedjava.lang.ArrayIndexOutOfBoundsExceptionif thefromis greater thantoor negative, if 'to' is greater thanbuflength ortolimit was exceeded during serializationjava.lang.NullPointerExceptionif any ofx,codec,buforconfigis null
- object JsonReader
- object JsonWriter
- object ReaderConfig extends ReaderConfig
- object WriterConfig extends WriterConfig