Package com.inrupt.client.jackson
Class JacksonService
java.lang.Object
com.inrupt.client.jackson.JacksonService
- All Implemented Interfaces:
JsonService
A
JsonService
using the Jackson JSON library.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
fromJson
(InputStream input, Class<T> clazz) Read JSON into a java object.<T> T
fromJson
(InputStream input, Type type) Read JSON into a java object.<T> void
toJson
(T object, OutputStream output) Write object data into JSON.
-
Constructor Details
-
JacksonService
public JacksonService()Create a Jackson service.
-
-
Method Details
-
toJson
Description copied from interface:JsonService
Write object data into JSON.- Specified by:
toJson
in interfaceJsonService
- Type Parameters:
T
- the object type- Parameters:
object
- the object to serializeoutput
- the output stream- Throws:
IOException
- when there is a serialization error
-
fromJson
Description copied from interface:JsonService
Read JSON into a java object.- Specified by:
fromJson
in interfaceJsonService
- Type Parameters:
T
- the object type- Parameters:
input
- the input streamclazz
- the object class- Returns:
- the newly created object
- Throws:
IOException
- when there is a parsing error
-
fromJson
Description copied from interface:JsonService
Read JSON into a java object.- Specified by:
fromJson
in interfaceJsonService
- Type Parameters:
T
- the object type- Parameters:
input
- the input streamtype
- the runtime type of the object- Returns:
- the newly created object
- Throws:
IOException
- when there is a parsing error
-