public class JsonSerializer
extends java.lang.Object
| Constructor and Description |
|---|
JsonSerializer(com.google.gson.Gson gson) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
read(java.lang.Class<T> expectedClass,
java.io.InputStream inputStream)
Read an expected class object from the given input.
|
void |
write(java.lang.Object object,
java.io.OutputStream outputStream)
Write the given object in the given output
|
public void write(@NonNull
java.lang.Object object,
@NonNull
java.io.OutputStream outputStream)
throws java.io.IOException
If any error occurs while writing, then an IOException is thrown.
The given output is not closed. If it should be, then it is the responsibility of the caller to do so.
object - object to write in outputoutputStream - output where to write injava.io.IOException - if any error occurs@NonNull
public <T> T read(@NonNull
java.lang.Class<T> expectedClass,
@NonNull
java.io.InputStream inputStream)
throws java.io.IOException
If any error occurs while reading, then an IOException is thrown.
The given input is not closed. If it should be, then it is the responsibility of the caller to do so.
expectedClass - type of the object to readinputStream - input where to read fromjava.io.IOException - if any error occurs