Package io.avaje.jsonb.stream
Class JsonStream
- java.lang.Object
-
- io.avaje.jsonb.stream.JsonStream
-
- All Implemented Interfaces:
JsonStreamAdapter
public final class JsonStream extends Object implements JsonStreamAdapter
Default implementation of JsonStreamAdapter provided with Jsonb.
-
-
Constructor Summary
Constructors Constructor Description JsonStream()Create with the given default configuration.JsonStream(boolean serializeNulls, boolean serializeEmpty, boolean failOnUnknown)Create additionally providing the jsonFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedJsonWriterbufferedWriter()Return a JsonWriter for use for writing to json string.BytesJsonWriterbufferedWriterAsBytes()Return a JsonWriter to use for writing json to byte array.PropertyNamesproperties(String... names)Return PropertyNames given the names of properties.JsonReaderreader(byte[] json)Return the JsonReader given json content as bytes.JsonReaderreader(InputStream inputStream)Return the JsonReader given json string content.JsonReaderreader(Reader reader)Return the JsonReader given json string content.JsonReaderreader(String json)Return the JsonReader given json string content.JsonWriterwriter(OutputStream outputStream)Return the JsonWriter given the outputStream.JsonWriterwriter(Writer writer)Return the JsonWriter given writer to use.
-
-
-
Constructor Detail
-
JsonStream
public JsonStream()
Create with the given default configuration.
-
JsonStream
public JsonStream(boolean serializeNulls, boolean serializeEmpty, boolean failOnUnknown)
Create additionally providing the jsonFactory.
-
-
Method Detail
-
properties
public PropertyNames properties(String... names)
Description copied from interface:JsonStreamAdapterReturn PropertyNames given the names of properties.The PropertyNames can prepare the names for writing such as escaping quotes and encoding to bytes so that the names can be written more efficiently.
- Specified by:
propertiesin interfaceJsonStreamAdapter- See Also:
JsonWriter.names(PropertyNames),JsonWriter.name(int)
-
reader
public JsonReader reader(String json)
Description copied from interface:JsonStreamAdapterReturn the JsonReader given json string content.- Specified by:
readerin interfaceJsonStreamAdapter
-
reader
public JsonReader reader(byte[] json)
Description copied from interface:JsonStreamAdapterReturn the JsonReader given json content as bytes.- Specified by:
readerin interfaceJsonStreamAdapter
-
reader
public JsonReader reader(Reader reader)
Description copied from interface:JsonStreamAdapterReturn the JsonReader given json string content.- Specified by:
readerin interfaceJsonStreamAdapter
-
reader
public JsonReader reader(InputStream inputStream)
Description copied from interface:JsonStreamAdapterReturn the JsonReader given json string content.- Specified by:
readerin interfaceJsonStreamAdapter
-
writer
public JsonWriter writer(Writer writer)
Description copied from interface:JsonStreamAdapterReturn the JsonWriter given writer to use.- Specified by:
writerin interfaceJsonStreamAdapter
-
writer
public JsonWriter writer(OutputStream outputStream)
Description copied from interface:JsonStreamAdapterReturn the JsonWriter given the outputStream.- Specified by:
writerin interfaceJsonStreamAdapter
-
bufferedWriter
public BufferedJsonWriter bufferedWriter()
Description copied from interface:JsonStreamAdapterReturn a JsonWriter for use for writing to json string.- Specified by:
bufferedWriterin interfaceJsonStreamAdapter
-
bufferedWriterAsBytes
public BytesJsonWriter bufferedWriterAsBytes()
Description copied from interface:JsonStreamAdapterReturn a JsonWriter to use for writing json to byte array.- Specified by:
bufferedWriterAsBytesin interfaceJsonStreamAdapter
-
-