Package com.helger.commons.serialize
Class SerializationHelper
java.lang.Object
com.helger.commons.serialize.SerializationHelper
Global serialization helper method.
- Since:
- 8.5.5
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetDeserializedObject(byte[] aData) Convert the passed byte array to an object using deserialization.static byte[]Convert the passed Serializable object to a serialized byte array.
-
Method Details
-
getSerializedByteArray
Convert the passed Serializable object to a serialized byte array.- Parameters:
aData- Source object. May not benull.- Returns:
- A non-
nullbyte array. - Throws:
IllegalStateException- If serialization failed
-
getDeserializedObject
Convert the passed byte array to an object using deserialization.- Type Parameters:
T- The type of the deserialized object- Parameters:
aData- The source serialized byte array. Must contain a single object only. May not benull.- Returns:
- The deserialized object. Never
null. - Throws:
IllegalStateException- If deserialization failed
-