java.lang.Object
is.codion.common.Serializer
Utility class for serialization.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
deserialize
(byte[] bytes) Deserializes the given byte array into a T, null or an empty byte array result in a null return valuestatic byte[]
Serializes the given Object, null object results in an empty byte array
-
Method Details
-
serialize
Serializes the given Object, null object results in an empty byte array- Parameters:
object
- the object- Returns:
- a byte array representing the serialized object, an empty byte array in case of null
- Throws:
IOException
- in case of an exception
-
deserialize
Deserializes the given byte array into a T, null or an empty byte array result in a null return value- Type Parameters:
T
- the type of the object represented in the byte array- Parameters:
bytes
- a byte array representing the serialized object- Returns:
- the deserialized object
- Throws:
IOException
- in case of an exceptionClassNotFoundException
- in case the deserialized class is not found
-