Class JacksonHelper
java.lang.Object
util.JacksonHelper
Helper class for reading and writing a list of objects to JSON.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List
<T> readList
(InputStream in, Class<T> elementClass) Deserializes a list of objects from JSON.static <T> void
writeList
(OutputStream out, List<T> list) Serializes a list of objects to JSON.
-
Constructor Details
-
JacksonHelper
public JacksonHelper()
-
-
Method Details
-
readList
Deserializes a list of objects from JSON.- Type Parameters:
T
- the type of the list elements- Parameters:
in
- the input stream from which JSON data will be readelementClass
- represents the class of the elements- Returns:
- the list of objects deserialized from JSON
- Throws:
IOException
- if any I/O error occurs
-
writeList
Serializes a list of objects to JSON.- Type Parameters:
T
- the type of the list elements- Parameters:
out
- the output stream to which JSON data will be writtenlist
- the list of objects to be serialized- Throws:
IOException
- if any I/O error occurs
-