public class SerializationUtils extends Object
Constructor and Description |
---|
SerializationUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
base64ToObject(String base64)
Deserializes a Java object from its binary representation (as base64 string)
|
static Object |
binaryFileToObject(Path file)
Deserializes a Java object from a binary file via
ObjectInputStream |
static <T> T |
jsonStringToObject(String json,
Class<T> klass)
Deserailizes a JSON string into an object via Jackson
|
static void |
jsonStringToParameterCollection(JIPipeParameterCollection target,
String json)
Deserializes JSON data into a
JIPipeParameterCollection |
static String |
objectToBase64(Object obj)
Serializes a Java object into its binary representation (via
ObjectOutputStream ) as base64 |
static void |
objectToBinaryFile(Object obj,
Path file)
Serializes a Java object into a file via
ObjectOutputStream |
static String |
objectToJsonString(Object obj)
Serializes an object to a JSON string
Must be serializable via the Jackson JSON library.
|
static String |
parameterCollectionToJsonString(JIPipeParameterCollection parameterCollection)
Serializes a
JIPipeParameterCollection into a JSON string |
public static String objectToJsonString(Object obj)
obj
- the objectpublic static <T> T jsonStringToObject(String json, Class<T> klass)
T
- the object classjson
- the JSON stringklass
- the object classpublic static String parameterCollectionToJsonString(JIPipeParameterCollection parameterCollection)
JIPipeParameterCollection
into a JSON stringparameterCollection
- the parameter collectionpublic static void jsonStringToParameterCollection(JIPipeParameterCollection target, String json)
JIPipeParameterCollection
target
- the target collectionjson
- the JSON stringpublic static void objectToBinaryFile(Object obj, Path file)
ObjectOutputStream
obj
- the objectfile
- the filepublic static Object binaryFileToObject(Path file)
ObjectInputStream
file
- the filepublic static String objectToBase64(Object obj)
ObjectOutputStream
) as base64obj
- the objectCopyright © 2020–2022 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.