A JsonCodec[A]
instance is a universal codec for JSON values and keys.
A JsonKeyCodec[A]
instance has the ability to decode and encode JSON keys to/from values of type A
,
potentially failing with an error if the JSON input is not a key or does not encode a value of the given type or
A
cannot be encoded properly according to RFC-8259 requirements.
A JsonValueCodec[A]
instance has the ability to decode and encode JSON values to/from values of type A
,
potentially failing with an error if the JSON content does not encode a value of the given type or A
cannot be
encoded properly according to RFC-8259 requirements.
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:
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:
JsonWriter.writeNonEscapedAsciiKey
or JsonWriter.writeNonEscapedAsciiVal
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given A
type.
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given A
type.
type of the value to parse
the byte array to parse from
a parsing configuration
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.NullPointerException
if the codec
, buf
or config
is null
Deserialize JSON content encoded in UTF-8 from a byte buffer into a value of given A
type.
Deserialize JSON content encoded in UTF-8 from a byte buffer into a value of given A
type.
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.
type of the value to parse
the byte buffer which will be parsed
a parsing configuration
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.NullPointerException
if the codec
, bbuf
or config
is null
Deserialize JSON content encoded in UTF-8 from an input stream into a value of given A
type.
Deserialize JSON content encoded in UTF-8 from an input stream into a value of given A
type.
type of the value to parse
the input stream to parse from
a parsing configuration
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.NullPointerException
if the codec
, in
or config
is null
Deserialize JSON content from a string into a value of given A
type.
Deserialize JSON content from a string into a value of given A
type.
While it much less efficient than parsing from a byte array using pooled readers but it can be safely used internally in custom codecs.
type of the value to parse
a value of string which will be parsed
a parsing configuration
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.NullPointerException
if the codec
, s
or config
is null
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given A
type.
Deserialize JSON content encoded in UTF-8 from a byte array into a value of given A
type.
type of the value to parse
the byte array to parse from
the start position of the provided byte array
the position of end of input in the provided byte array
a parsing configuration
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.ArrayIndexOutOfBoundsException
if the to
is greater than buf
length or negative,
or from
is greater than to
or negative
java.lang.NullPointerException
if the codec
, buf
or config
is null
Deserialize JSON array encoded in UTF-8 from an input stream into its values of given A
type.
Deserialize JSON array encoded in UTF-8 from an input stream into its values of given A
type.
All parsed values will be passed to consuming function f
.
type of the value to parse
the input stream to parse from
a parsing configuration
a consumer of values, that returns true
to continue scanning or false
to complete it
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.NullPointerException
if the codec
, in
or config
is null
java.lang.Throwable
if some error was thrown by f() call
Deserialize JSON of streaming values encoded in UTF-8 from an input stream into values of given A
type.
Deserialize JSON of streaming values encoded in UTF-8 from an input stream into values of given A
type.
All parsed values will be passed to consuming function f
.
type of the value to parse
the input stream to parse from
a parsing configuration
a consumer of values, that returns true
to continue scanning or false
to complete it
a codec for the given A
type
a successfully parsed value
JsonReaderException
if 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 expected
java.lang.NullPointerException
if the codec
, in
or config
is null
java.lang.Throwable
if some error was thrown by f() call
Serialize the x
argument to a new allocated instance of byte array in UTF-8 encoding of JSON format.
Serialize the x
argument to a new allocated instance of byte array in UTF-8 encoding of JSON format.
type of value to serialize
the value to serialize
a serialization configuration
a codec for the given value
a byte array with x
serialized to JSON
JsonWriterException
if the value to serialize contains strings, double or float values which cannot be
properly encoded
java.lang.NullPointerException
if the codec
or config
is null
Serialize the x
argument to the given instance of byte buffer in UTF-8 encoding of JSON format.
Serialize the x
argument 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.
type of value to serialize
the value to serialize
a byte buffer where the value should be serialized
a serialization configuration
a codec for the given value
JsonWriterException
if the value to serialize contains strings, double or float values which cannot be
properly encoded
java.lang.NullPointerException
if the codec
, bbuf
or config
is null
java.nio.BufferOverflowException
if the bbuf
limit was exceeded during serialization
java.nio.ReadOnlyBufferException
if the bbuf
is read-only
Serialize the x
argument to the provided output stream in UTF-8 encoding of JSON format.
Serialize the x
argument to the provided output stream in UTF-8 encoding of JSON format.
type of value to serialize
the value to serialize
an output stream to serialize into
a serialization configuration
a codec for the given value
JsonWriterException
if the value to serialize contains strings, double or float values which cannot be
properly encoded
java.io.IOException
if an I/O error occurs in a call to output stream
java.lang.NullPointerException
if the codec
, out
or config
is null
Serialize the x
argument to a string in JSON format.
Serialize the x
argument to a string in JSON format.
While it much less efficient than serialization to a byte array using pooled writers but it can be safely used internally in custom codecs.
type of value to serialize
the value to serialize
a serialization configuration
a codec for the given value
a string with x
serialized to JSON
JsonWriterException
if the value to serialize contains strings, double or float values which cannot be
properly encoded
java.lang.NullPointerException
if the codec
or config
is null
Serialize the x
argument to the given instance of byte array in UTF-8 encoding of JSON format.
Serialize the x
argument to the given instance of byte array in UTF-8 encoding of JSON format.
type of value to serialize
the value to serialize
a byte array where the value should be serialized
a position in the byte array from which serialization of the value should start
an exclusive position in the byte array that limits where serialization of the value should stop
a serialization configuration
a codec for the given value
number of next position after last byte serialized to buf
JsonWriterException
if the value to serialize contains strings, double or float values which cannot be
properly encoded
java.lang.ArrayIndexOutOfBoundsException
if the from
is greater than to
or negative, if 'to' is greater
than buf
length or to
limit was exceeded during serialization
java.lang.NullPointerException
if the codec
, buf
or config
is null