com.jstatcom.util
Class SerializationHelper
- java.lang.Object
-
- com.jstatcom.util.SerializationHelper
-
public final class SerializationHelper extends java.lang.ObjectHelper methods for (de)serialization and de/encoding to strings.
-
-
Constructor Summary
Constructors Constructor and Description SerializationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static <T> Tdecode(java.lang.String encodedString)Decode Base64 encoded string (withencode).static java.lang.Stringencode(java.lang.Object o)Base64 encoding of serializable objects.static byte[]getByteFromObject(java.lang.Object o)Serializesoto a byte array representation.static <T> TgetObjectFromByteArray(byte[] byteArray)Deserializes an object from the byte array representation of the serialized version.
-
-
-
Method Detail
-
getByteFromObject
public static byte[] getByteFromObject(java.lang.Object o)
Serializesoto a byte array representation.- Parameters:
o- object to serialize- Returns:
- byte array with serialized
o - Throws:
java.lang.IllegalArgumentException-if (!(o instanceof Serializable))
-
getObjectFromByteArray
public static <T> T getObjectFromByteArray(byte[] byteArray)
Deserializes an object from the byte array representation of the serialized version.- Parameters:
byteArray- byte array representation of serialized object- Returns:
- deserialized object
-
encode
public static java.lang.String encode(java.lang.Object o)
Base64 encoding of serializable objects.- Parameters:
o- serializable object, may benull- Returns:
- Base64 eoncoded string
- Throws:
java.lang.IllegalArgumentException-if (o != null && !(o instanceof Serializable))
-
decode
public static <T> T decode(java.lang.String encodedString)
Decode Base64 encoded string (withencode).- Parameters:
encodedString- may benull- Returns:
- instance of
Tornullif argument wasnull
-
-
DMelt 3.0 © DataMelt by jWork.ORG