@ThreadSafe
public final class SerializationUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.io.Serializable |
deserialize(byte[] bytes)
Deserializes a byte array into an object.
|
static java.io.Serializable |
deserialize(byte[] bytes,
java.lang.String errorMessage)
Wrapper around
#deserialize(Object) which throws a runtime exception with the given
message on failure. |
static <S,T extends java.io.Serializable> |
makeValuesSerializable(java.util.Map<S,java.util.Collection<T>> map) |
static byte[] |
serialize(java.lang.Object obj)
Serializes an object into a byte array.
|
static byte[] |
serialize(java.lang.Object obj,
java.lang.String errorMessage)
Wrapper around
serialize(Object) which throws a runtime exception with the given
message on failure. |
public static byte[] serialize(java.lang.Object obj)
throws java.io.IOException
obj - the object to serializejava.io.IOException - if the serialization failspublic static byte[] serialize(java.lang.Object obj,
java.lang.String errorMessage)
serialize(Object) which throws a runtime exception with the given
message on failure.obj - the object the serializeerrorMessage - the message to show if serialization failspublic static java.io.Serializable deserialize(byte[] bytes)
throws java.io.IOException,
java.lang.ClassNotFoundException
bytes - the byte array to deserializejava.io.IOException - if the deserialization failsjava.lang.ClassNotFoundException - if no class found to deserialize intopublic static java.io.Serializable deserialize(byte[] bytes,
java.lang.String errorMessage)
#deserialize(Object) which throws a runtime exception with the given
message on failure.bytes - the byte array the deserializeerrorMessage - the message to show if deserialization failspublic static <S,T extends java.io.Serializable> java.util.Map<S,java.util.ArrayList<T>> makeValuesSerializable(java.util.Map<S,java.util.Collection<T>> map)
S - the key type for the MapT - the type of the values in the collections which are the values for the Mapmap - a map to make serializableCopyright © 2022. All Rights Reserved.