|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dslplatform.json.DslJson<TContext>
TContext - used for library specialization. If unsure, use Objectpublic class DslJson<TContext>
Main DSL-JSON class. Easiest way to use the library is to create an DslJson<Object> instance and reuse it within application. DslJson has optional constructor for specifying default readers/writers.
During initialization DslJson will use ServiceLoader API to load registered services. This is done through `META-INF/services/com.dslplatform.json.CompiledJson` file.
DslJson can fallback to another serializer in case when it doesn't know how to handle specific type. This can be specified by Fallback interface during initialization.
If you wish to use compile time databinding @CompiledJson annotation must be specified on the target class or implicit reference to target class must exists from a class with @CompiledJson annotation.
Usage example:
DslJson<Object> dsl = new DslJson<>();
dsl.serialize(instance, OutputStream);
POJO pojo = dsl.deserialize(POJO.class, InputStream);
For best performance use serialization API with JsonWriter and byte[] as target. JsonWriter is reused via thread local variable. When custom JsonWriter's are used, reusing them will yield maximum performance. JsonWriter can be reused via reset methods. For best deserialization performance prefer byte[] API instead of InputStream API. JsonReader is reused via thread local variable. When custom JsonReaders are used, reusing them will yield maximum performance. JsonReader can be reused via process methods.
During deserialization TContext can be used to pass data into deserialized classes. This is useful when deserializing domain objects which require state or service provider. For example DSL Platform entities require service locator to be able to perform lazy load.
DslJson doesn't have a String or Reader API since it's optimized for processing bytes and streams. If you wish to process String, use String.getBytes("UTF-8") as argument for DslJson. Only UTF-8 is supported for encoding and decoding JSON.
DslJson<Object> dsl = new DslJson<>();
JsonWriter writer = dsl.newWriter();
dsl.serialize(writer, instance);
String json = writer.toString(); //JSON as string - avoid using JSON as Strings whenever possible
byte[] input = json.getBytes("UTF-8");
POJO pojo = dsl.deserialize(POJO.class, input, input.length);
| Nested Class Summary | |
|---|---|
static interface |
DslJson.ConverterFactory<T>
|
static interface |
DslJson.Fallback<TContext>
|
static class |
DslJson.Settings<TContext>
Configuration for DslJson options. |
static class |
DslJson.SimpleStringCache
Simplistic string cache implementation. |
| Field Summary | |
|---|---|
boolean |
allowArrayFormat
When object supports array format, eg. |
protected List<DslJson.ConverterFactory<JsonReader.BindObject>> |
binderFactories
|
TContext |
context
The context of this instance. |
protected DslJson.Fallback<TContext> |
fallback
|
protected StringCache |
keyCache
|
protected ThreadLocal<JsonReader> |
localReader
|
protected ThreadLocal<JsonWriter> |
localWriter
|
boolean |
omitDefaults
Should properties with default values be omitted from the resulting JSON? |
protected List<DslJson.ConverterFactory<JsonReader.ReadObject>> |
readerFactories
|
protected StringCache |
valuesCache
|
protected List<DslJson.ConverterFactory<JsonWriter.WriteObject>> |
writerFactories
|
| Constructor Summary | |
|---|---|
DslJson()
Simple initialization entry point. |
|
DslJson(DslJson.Settings<TContext> settings)
Fully configurable entry point. |
|
DslJson(TContext context,
boolean javaSpecifics,
DslJson.Fallback<TContext> fallback,
boolean omitDefaults,
StringCache keyCache,
Iterable<Configuration> serializers)
Deprecated. |
|
| Method Summary | ||
|---|---|---|
boolean |
canDeserialize(Type manifest)
Check if DslJson knows how to deserialize a type. |
|
boolean |
canSerialize(Type manifest)
Check if DslJson knows how to serialize a type. |
|
|
deserialize(Class<TResult> manifest,
byte[] body,
int size)
Convenient deserialize API for working with bytes. |
|
|
deserialize(Class<TResult> manifest,
InputStream stream)
Convenient deserialize API for working with streams. |
|
|
deserialize(Class<TResult> manifest,
InputStream stream,
byte[] buffer)
Convenient deserialize API for working with streams. |
|
|
deserialize(JsonReader.ReadObject<T> converter,
JsonReader<TContext> input)
Reusable deserialize API. |
|
Object |
deserialize(Type manifest,
byte[] body,
int size)
Deserialize API for working with bytes. |
|
Object |
deserialize(Type manifest,
InputStream stream)
Deserialize API for working with streams. |
|
Object |
deserialize(Type manifest,
InputStream stream,
byte[] buffer)
Deserialize API for working with streams. |
|
|
deserializeList(Class<TResult> manifest,
byte[] body,
int size)
Convenient deserialize list API for working with bytes. |
|
|
deserializeList(Class<TResult> manifest,
InputStream stream)
Convenient deserialize list API for working with streams. |
|
|
deserializeList(Class<TResult> manifest,
InputStream stream,
byte[] buffer)
This is deprecated to avoid using it. |
|
static ArrayList<Object> |
deserializeList(JsonReader reader)
Deprecated. |
|
static LinkedHashMap<String,Object> |
deserializeMap(JsonReader reader)
Deprecated. |
|
static Object |
deserializeObject(JsonReader reader)
Deprecated. |
|
Object |
getDefault(Type manifest)
|
|
protected JsonReader.ReadJsonObject<JsonObject> |
getObjectReader(Class<?> manifest)
|
|
Set<Type> |
getRegisteredBinders()
|
|
Set<Type> |
getRegisteredDecoders()
|
|
Set<Type> |
getRegisteredEncoders()
|
|
|
iterateOver(Class<TResult> manifest,
InputStream stream)
Streaming API for collection deserialization. |
|
|
iterateOver(Class<TResult> manifest,
InputStream stream,
byte[] buffer)
Streaming API for collection deserialization. |
|
|
iterateOver(Iterator<T> iterator,
Class<T> manifest,
OutputStream stream,
JsonWriter writer)
Streaming API for collection serialization. |
|
|
iterateOver(Iterator<T> iterator,
OutputStream stream,
JsonWriter writer)
Streaming API for collection serialization. |
|
JsonReader<TContext> |
newReader()
Create a reader bound to this DSL-JSON. |
|
JsonReader<TContext> |
newReader(byte[] bytes)
Create a reader bound to this DSL-JSON. |
|
JsonReader<TContext> |
newReader(byte[] bytes,
int length)
Create a reader bound to this DSL-JSON. |
|
JsonReader<TContext> |
newReader(byte[] bytes,
int length,
char[] tmp)
Create a reader bound to this DSL-JSON. |
|
JsonReader<TContext> |
newReader(InputStream stream,
byte[] buffer)
Create a reader bound to this DSL-JSON. |
|
JsonReader<TContext> |
newReader(String input)
Deprecated. |
|
JsonWriter |
newWriter()
Create a writer bound to this DSL-JSON. |
|
JsonWriter |
newWriter(byte[] buffer)
Create a writer bound to this DSL-JSON. |
|
JsonWriter |
newWriter(int size)
Create a writer bound to this DSL-JSON. |
|
|
registerBinder(Class<T> manifest,
JsonReader.BindObject<S> binder)
Register custom binder for specific type (JSON -> instance conversion). |
|
void |
registerBinder(Type manifest,
JsonReader.BindObject<?> binder)
Register custom binder for specific type (JSON -> instance conversion). |
|
boolean |
registerBinderFactory(DslJson.ConverterFactory<? extends JsonReader.BindObject> factory)
|
|
|
registerDefault(Class<T> manifest,
T instance)
|
|
|
registerReader(Class<T> manifest,
JsonReader.ReadObject<S> reader)
Register custom reader for specific type (JSON -> instance conversion). |
|
JsonReader.ReadObject |
registerReader(Type manifest,
JsonReader.ReadObject<?> reader)
Register custom reader for specific type (JSON -> instance conversion). |
|
boolean |
registerReaderFactory(DslJson.ConverterFactory<? extends JsonReader.ReadObject> factory)
|
|
|
registerWriter(Class<T> manifest,
JsonWriter.WriteObject<T> writer)
Register custom writer for specific type (instance -> JSON conversion). |
|
JsonWriter.WriteObject |
registerWriter(Type manifest,
JsonWriter.WriteObject<?> writer)
Register custom writer for specific type (instance -> JSON conversion). |
|
boolean |
registerWriterFactory(DslJson.ConverterFactory<? extends JsonWriter.WriteObject> factory)
|
|
|
serialize(JsonWriter writer,
Collection<T> collection)
Deprecated. |
|
|
serialize(JsonWriter writer,
List<T> list)
Deprecated. |
|
void |
serialize(JsonWriter writer,
Object value)
Main serialization API. |
|
|
serialize(JsonWriter writer,
T[] array)
Deprecated. |
|
|
serialize(JsonWriter writer,
T[] array,
int len)
Deprecated. |
|
boolean |
serialize(JsonWriter writer,
Type manifest,
Object value)
Generic serialize API. |
|
void |
serialize(Object value,
OutputStream stream)
Convenient serialize API. |
|
void |
serializeMap(Map<String,Object> value,
JsonWriter sw)
|
|
|
tryFindBinder(Class<T> manifest)
Try to find registered binder for provided type. |
|
JsonReader.BindObject<?> |
tryFindBinder(Type manifest)
Try to find registered binder for provided type. |
|
|
tryFindReader(Class<T> manifest)
Try to find registered reader for provided type. |
|
JsonReader.ReadObject<?> |
tryFindReader(Type manifest)
Try to find registered reader for provided type. |
|
|
tryFindWriter(Class<T> manifest)
Try to find registered writer for provided type. |
|
JsonWriter.WriteObject<?> |
tryFindWriter(Type manifest)
Try to find registered writer for provided type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Nullable public final TContext context
@Nullable protected final DslJson.Fallback<TContext> fallback
public final boolean omitDefaults
public final boolean allowArrayFormat
protected final StringCache keyCache
protected final StringCache valuesCache
protected final List<DslJson.ConverterFactory<JsonWriter.WriteObject>> writerFactories
protected final List<DslJson.ConverterFactory<JsonReader.ReadObject>> readerFactories
protected final List<DslJson.ConverterFactory<JsonReader.BindObject>> binderFactories
protected final ThreadLocal<JsonWriter> localWriter
protected final ThreadLocal<JsonReader> localReader
| Constructor Detail |
|---|
public DslJson()
@Deprecated
public DslJson(@Nullable
TContext context,
boolean javaSpecifics,
@Nullable
DslJson.Fallback<TContext> fallback,
boolean omitDefaults,
@Nullable
StringCache keyCache,
Iterable<Configuration> serializers)
context - context instance which can be provided to deserialized objects. Use null if not surejavaSpecifics - register Java graphics specific classes such as java.awt.Point, Image, ...fallback - in case of unsupported type, try serialization/deserialization through external APIomitDefaults - should serialization produce minified JSON (omit nulls and default values)keyCache - parsed keys can be cached (this is only used in small subset of parsing)serializers - additional serializers/deserializers which will be immediately registered into readers/writerspublic DslJson(DslJson.Settings<TContext> settings)
settings - DSL-JSON configuration| Method Detail |
|---|
public JsonWriter newWriter()
public JsonWriter newWriter(int size)
size - initial buffer size
public JsonWriter newWriter(byte[] buffer)
buffer - initial buffer
public JsonReader<TContext> newReader()
public JsonReader<TContext> newReader(byte[] bytes)
bytes - input bytes
public JsonReader<TContext> newReader(byte[] bytes,
int length)
bytes - input byteslength - use input bytes up to specified length
public JsonReader<TContext> newReader(byte[] bytes,
int length,
char[] tmp)
bytes - input byteslength - use input bytes up to specified lengthtmp - string parsing buffer
public JsonReader<TContext> newReader(InputStream stream,
byte[] buffer)
throws IOException
stream - input streambuffer - temporary buffer
IOException - unable to read from stream@Deprecated public JsonReader<TContext> newReader(String input)
input - JSON string
public <T> void registerDefault(Class<T> manifest,
T instance)
public boolean registerWriterFactory(DslJson.ConverterFactory<? extends JsonWriter.WriteObject> factory)
public boolean registerReaderFactory(DslJson.ConverterFactory<? extends JsonReader.ReadObject> factory)
public boolean registerBinderFactory(DslJson.ConverterFactory<? extends JsonReader.BindObject> factory)
@Nullable
public final Object getDefault(@Nullable
Type manifest)
public final Set<Type> getRegisteredDecoders()
public final Set<Type> getRegisteredBinders()
public final Set<Type> getRegisteredEncoders()
public <T,S extends T> void registerReader(Class<T> manifest,
@Nullable
JsonReader.ReadObject<S> reader)
Types registered through @CompiledJson annotation should be registered automatically through ServiceLoader.load method and you should not be registering them manually.
If null is registered for a reader this will disable deserialization of specified type
T - typeS - type or subtypemanifest - specified typereader - provide custom implementation for reading JSON into an object instance
@Nullable
public JsonReader.ReadObject registerReader(Type manifest,
@Nullable
JsonReader.ReadObject<?> reader)
Types registered through @CompiledJson annotation should be registered automatically through ServiceLoader.load method and you should not be registering them manually.
If null is registered for a reader this will disable deserialization of specified type
manifest - specified typereader - provide custom implementation for reading JSON into an object instance
public <T,S extends T> void registerBinder(Class<T> manifest,
@Nullable
JsonReader.BindObject<S> binder)
Types registered through @CompiledJson annotation should be registered automatically through ServiceLoader.load method and you should not be registering them manually.
If null is registered for a binder this will disable binding of specified type
T - typeS - type or subtypemanifest - specified typebinder - provide custom implementation for binding JSON to an object instance
public void registerBinder(Type manifest,
@Nullable
JsonReader.BindObject<?> binder)
Types registered through @CompiledJson annotation should be registered automatically through ServiceLoader.load method and you should not be registering them manually.
If null is registered for a binder this will disable binding of specified type
manifest - specified typebinder - provide custom implementation for binding JSON to an object instance
public <T> void registerWriter(Class<T> manifest,
@Nullable
JsonWriter.WriteObject<T> writer)
Types registered through @CompiledJson annotation should be registered automatically through ServiceLoader.load method and you should not be registering them manually.
If null is registered for a writer this will disable serialization of specified type
T - typemanifest - specified typewriter - provide custom implementation for writing JSON from object instance
@Nullable
public JsonWriter.WriteObject registerWriter(Type manifest,
@Nullable
JsonWriter.WriteObject<?> writer)
Types registered through @CompiledJson annotation should be registered automatically through ServiceLoader.load method and you should not be registering them manually.
If null is registered for a writer this will disable serialization of specified type
manifest - specified typewriter - provide custom implementation for writing JSON from object instance
@Nullable public JsonWriter.WriteObject<?> tryFindWriter(Type manifest)
Writer is used for conversion from object instance into JSON representation.
manifest - specified type
@Nullable public JsonReader.ReadObject<?> tryFindReader(Type manifest)
If you wish to use alternative reader for specific type, register it manually with something along the lines of
DslJson dslJson = ...
dslJson.registerReader(Interface.class, dslJson.tryFindReader(Implementation.class));
manifest - specified type
@Nullable public JsonReader.BindObject<?> tryFindBinder(Type manifest)
If you wish to use alternative binder for specific type, register it manually with something along the lines of
DslJson dslJson = ...
dslJson.registerBinder(Interface.class, dslJson.tryFindBinder(Implementation.class));
manifest - specified type
@Nullable public <T> JsonWriter.WriteObject<T> tryFindWriter(Class<T> manifest)
Writer is used for conversion from object instance into JSON representation.
T - specified typemanifest - specified class
@Nullable public <T> JsonReader.ReadObject<T> tryFindReader(Class<T> manifest)
If you wish to use alternative reader for specific type, register it manually with something along the lines of
DslJson dslJson = ...
dslJson.registerReader(Interface.class, dslJson.tryFindReader(Implementation.class));
T - specified typemanifest - specified class
@Nullable public <T> JsonReader.BindObject<T> tryFindBinder(Class<T> manifest)
If you wish to use alternative binder for specific type, register it manually with something along the lines of
DslJson dslJson = ...
dslJson.registerBinder(Interface.class, dslJson.tryFindBinder(Implementation.class));
T - specified typemanifest - specified class
@Nullable protected final JsonReader.ReadJsonObject<JsonObject> getObjectReader(Class<?> manifest)
public void serializeMap(Map<String,Object> value,
JsonWriter sw)
throws IOException
IOException
@Deprecated
@Nullable
public static Object deserializeObject(JsonReader reader)
throws IOException
IOException
@Deprecated
public static ArrayList<Object> deserializeList(JsonReader reader)
throws IOException
reader - JSON reader
IOException - error during parsing
@Deprecated
public static LinkedHashMap<String,Object> deserializeMap(JsonReader reader)
throws IOException
reader - JSON reader
IOException - error during parsingpublic final boolean canSerialize(Type manifest)
manifest - type to check
public final boolean canDeserialize(Type manifest)
manifest - type to check
@Nullable
public <T> T deserialize(JsonReader.ReadObject<T> converter,
JsonReader<TContext> input)
throws IOException
This is mostly convenience API since it starts the processing of the JSON by calling getNextToken on JsonReader, checks for null and calls converter.read(input).
T - specified typeconverter - target readerinput - input JSON
IOException - error during deserialization
@Nullable
public <TResult> TResult deserialize(Class<TResult> manifest,
byte[] body,
int size)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
TResult - target typemanifest - target typebody - input JSONsize - length
IOException - error during deserialization
@Nullable
public Object deserialize(Type manifest,
byte[] body,
int size)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
manifest - target typebody - input JSONsize - length
IOException - error during deserialization
@Nullable
public <TResult> List<TResult> deserializeList(Class<TResult> manifest,
byte[] body,
int size)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
TResult - target element typemanifest - target typebody - input JSONsize - length
IOException - error during deserialization
@Nullable
public <TResult> List<TResult> deserializeList(Class<TResult> manifest,
InputStream stream,
byte[] buffer)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
When working on InputStream DslJson will process JSON in chunks of byte[] inputs. Provided buffer will be used as input for partial processing.
For best performance buffer should be reused.
TResult - target element typemanifest - target typestream - input JSONbuffer - buffer used for InputStream -> byte[] conversion
IOException - error during deserialization
@Nullable
public <TResult> List<TResult> deserializeList(Class<TResult> manifest,
InputStream stream)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
When working on InputStream DslJson will process JSON in chunks of byte[] inputs.
TResult - target element typemanifest - target typestream - input JSON
IOException - error during deserialization
@Nullable
public <TResult> TResult deserialize(Class<TResult> manifest,
InputStream stream,
byte[] buffer)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
When working on InputStream DslJson will process JSON in chunks of byte[] inputs. Provided buffer will be used as input for partial processing.
For best performance buffer should be reused.
TResult - target typemanifest - target typestream - input JSONbuffer - buffer used for InputStream -> byte[] conversion
IOException - error during deserialization
@Nullable
public <TResult> TResult deserialize(Class<TResult> manifest,
InputStream stream)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
When working on InputStream DslJson will process JSON in chunks of byte[] inputs.
TResult - target typemanifest - target typestream - input JSON
IOException - error during deserialization
@Nullable
public Object deserialize(Type manifest,
InputStream stream,
byte[] buffer)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them. DslJson will treat input as a sequence of bytes which allows for various optimizations.
When working on InputStream DslJson will process JSON in chunks of byte[] inputs. Provided buffer will be used as input for partial processing.
For best performance buffer should be reused.
manifest - target typestream - input JSONbuffer - buffer used for InputStream -> byte[] conversion
IOException - error during deserialization
@Nullable
public Object deserialize(Type manifest,
InputStream stream)
throws IOException
Since JSON is often though of as a series of char, most libraries will convert inputs into a sequence of chars and do processing on them.
When working on InputStream DslJson will process JSON in chunks of byte[] inputs.
manifest - target typestream - input JSON
IOException - error during deserialization
@Nullable
public <TResult> Iterator<TResult> iterateOver(Class<TResult> manifest,
InputStream stream)
throws IOException
Useful for processing very large streams if only one instance from collection is required at once.
Stream will be processed in chunks of specified buffer byte[]. It will block on reading until buffer is full or end of stream is detected.
TResult - type infomanifest - type infostream - JSON data stream
IOException - if reader is not found or there is an error processing input stream
@Nullable
public <TResult> Iterator<TResult> iterateOver(Class<TResult> manifest,
InputStream stream,
byte[] buffer)
throws IOException
Useful for processing very large streams if only one instance from collection is required at once.
Stream will be processed in chunks of specified buffer byte[]. It will block on reading until buffer is full or end of stream is detected.
TResult - type infomanifest - type infostream - JSON data streambuffer - size of processing chunk
IOException - if reader is not found or there is an error processing input stream
public <T> void iterateOver(Iterator<T> iterator,
OutputStream stream,
@Nullable
JsonWriter writer)
throws IOException
It will iterate over entire iterator and serialize each instance into target output stream. After each instance serialization it will copy JSON into target output stream. During each serialization reader will be looked up based on next() instance which allows serializing collection with different types. If collection contains all instances of the same type, prefer the other streaming API.
If reader is not found an IOException will be thrown
If JsonWriter is provided it will be used, otherwise a new instance will be internally created.
T - input data typeiterator - input datastream - target JSON streamwriter - temporary buffer for serializing a single item. Can be null
IOException - reader is not found, there is an error during serialization or problem with writing to target stream
public <T> void iterateOver(Iterator<T> iterator,
Class<T> manifest,
OutputStream stream,
@Nullable
JsonWriter writer)
throws IOException
It will iterate over entire iterator and serialize each instance into target output stream. After each instance serialization it will copy JSON into target output stream.
If reader is not found an IOException will be thrown
If JsonWriter is provided it will be used, otherwise a new instance will be internally created.
T - input data typeiterator - input datamanifest - type of elements in collectionstream - target JSON streamwriter - temporary buffer for serializing a single item. Can be null
IOException - reader is not found, there is an error during serialization or problem with writing to target stream
@Deprecated
public <T extends JsonObject> void serialize(JsonWriter writer,
@Nullable
T[] array)
T - typewriter - writerarray - items
@Deprecated
public <T extends JsonObject> void serialize(JsonWriter writer,
T[] array,
int len)
T - typewriter - writerarray - itemslen - part of array
@Deprecated
public <T extends JsonObject> void serialize(JsonWriter writer,
@Nullable
List<T> list)
T - typewriter - writerlist - items
@Deprecated
public <T extends JsonObject> void serialize(JsonWriter writer,
@Nullable
Collection<T> collection)
T - typewriter - writercollection - items
public boolean serialize(JsonWriter writer,
Type manifest,
@Nullable
Object value)
Resulting JSON will be written into provided writer argument. In case of successful serialization true will be returned.
For best performance writer argument should be reused.
writer - where to write resulting JSONmanifest - type manifestvalue - instance to serialize
public final void serialize(@Nullable
Object value,
OutputStream stream)
throws IOException
value - instance to serializestream - where to write resulting JSON
IOException - error when unable to serialize instance
public final void serialize(JsonWriter writer,
@Nullable
Object value)
throws IOException
JsonWriter contains a growable byte[] where JSON will be serialized. After serialization JsonWriter can be copied into OutputStream or it's byte[] can be obtained
For best performance reuse `JsonWriter` or even better call `JsonWriter.WriteObject` directly
writer - where to write resulting JSONvalue - object instance to serialize
IOException - error when unable to serialize instance
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||