public class JSONCodec
extends java.lang.Object
Constructor and Description |
---|
JSONCodec()
Constructor using the default configuration.
|
JSONCodec(JSONCodecConfiguration cfg)
Constructor using a specific configuration.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
decodeObject(java.io.InputStream inputStream,
java.lang.Class<T> targetType)
Decodes the given JSON string from input stream into a Java object of the given target type T.
|
<T> T |
decodeObject(java.io.InputStream inputStream,
T targetObject)
Decodes the given JSON string from input stream into the given target object of type T.
|
<T> T |
decodeObject(java.lang.String jsonString,
java.lang.Class<T> targetType)
Decodes the given JSON string into a Java object of the given target type T.
|
<T> T |
decodeObject(java.lang.String jsonString,
T javaObject)
Decodes the given jsonString into the given target javaObject of type T.
|
java.lang.String |
encodeObject(java.lang.Object o)
Encodes given Java object into a JSON string, which is returned.
|
void |
encodeObject(java.lang.Object javaObject,
java.io.OutputStream out)
Encodes given Java object into a JSON string, wirtten to out.
|
public JSONCodec()
JSONDefaults#CODEC_CONFIG}
public JSONCodec(JSONCodecConfiguration cfg)
cfg
- JSONCodecConfiguration
to be used by the new JSONCodec.public <T> T decodeObject(java.lang.String jsonString, T javaObject) throws JSONException
JSONException
public <T> T decodeObject(java.io.InputStream inputStream, T targetObject) throws JSONException
JSONException
public <T> T decodeObject(java.io.InputStream inputStream, java.lang.Class<T> targetType) throws JSONException
JSONException
public <T> T decodeObject(java.lang.String jsonString, java.lang.Class<T> targetType) throws JSONException
JSONException
public java.lang.String encodeObject(java.lang.Object o) throws JSONException
JSONException
public void encodeObject(java.lang.Object javaObject, java.io.OutputStream out) throws JSONException
JSONException