public class JsonStreamReader<S,T> extends java.lang.Object implements SourceReader<S,T>
S
and de-serialises it as a
T
-value.JsonStreamWriter
Constructor and Description |
---|
JsonStreamReader(java.lang.Class<T> valueType,
java.util.function.Function<S,java.io.Reader> toReader)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
T |
read(S in)
Reads JSON from the input stream and de-serialises it into a
T -value. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
uncheckedRead
public JsonStreamReader(java.lang.Class<T> valueType, java.util.function.Function<S,java.io.Reader> toReader)
valueType
- the class of the object to read.toReader
- converts a stream of type S
to a Reader
.java.lang.NullPointerException
- if any argument is null
.public T read(S in) throws java.lang.Exception
T
-value.read
in interface SourceReader<S,T>
in
- the stream to read from.java.lang.NullPointerException
- if the argument is null
.java.lang.Exception
- if an error occurs while reading from the stream or
converting JSON into an object.