public final class JsIO extends Object
JsReader
,
JsSpec.readNextValue(JsReader)
Modifier and Type | Field and Description |
---|---|
static JsIO |
INSTANCE
Singleton instance
|
Modifier and Type | Method and Description |
---|---|
JsReader |
createReader(byte[] bytes)
Creates a JSON reader from an array of bytes.
|
JsReader |
createReader(InputStream is)
Creates a JSON reader from an input stream.
|
JsArray |
parseToJsArray(byte[] bytes)
Parses the given array of bytes into an immutable and persistent JSON array.
|
JsObj |
parseToJsObj(byte[] bytes)
Parses the given array of bytes into an immutable and persistent JSON object.
|
byte[] |
serialize(Json<?> json)
Serializes the specified JSON into an array of bytes
|
void |
serialize(Json<?> json,
OutputStream stream)
Serializes the specified JSON into the given output stream
|
String |
toPrettyString(Json<?> json,
int indentLength)
Serializes a JSON into a formatted string
|
public static final JsIO INSTANCE
public JsObj parseToJsObj(byte[] bytes)
bytes
- the array of bytesJsParserException
- if the string doesn't represent a json objectpublic JsArray parseToJsArray(byte[] bytes)
bytes
- the array of bytesJsParserException
- if the string doesn't represent a json objectpublic JsReader createReader(byte[] bytes)
bytes
- the array of bytespublic JsReader createReader(InputStream is) throws JsParserException
is
- the input streamJsParserException
public byte[] serialize(Json<?> json) throws JsSerializerException
json
- the JSONJsSerializerException
public void serialize(Json<?> json, OutputStream stream) throws JsSerializerException
json
- the JSONstream
- the streamJsSerializerException
Copyright © 2023. All rights reserved.