public class SerializationUtils extends SerializationUtils
SerializationUtils
class defines helper methods for
serialization.Constructor and Description |
---|
SerializationUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
decompressAndDeserialize(byte[] data)
Decompresses and deserializes the blob back into the original object.
|
static Object |
decompressAndDeserialize(InputStream inputStream)
Decompresses and deserializes an object from the specified stream.
|
static byte[] |
serializeAndCompress(Serializable obj)
Serializes and compresses a given object.
|
static void |
serializeAndCompress(Serializable obj,
OutputStream outputStream)
Serializes and compresses a given object to the specified stream.
|
clone, deserialize, deserialize, roundtrip, serialize, serialize
public static void serializeAndCompress(Serializable obj, OutputStream outputStream)
The stream will be closed once the object is written. This avoids the need for a finally clause, and maybe also exception handling, in the application code.
The stream passed in is not buffered internally within this method. This is the responsibility of your application if desired.
obj
- the object to serialize and compressoutputStream
- the stream to write toSerializationException
- (runtime) if the serialization failsNullPointerException
- if outputStream
is null
public static byte[] serializeAndCompress(Serializable obj)
obj
- the object to serialize and compressSerializationException
- (runtime) if the serialization failspublic static Object decompressAndDeserialize(InputStream inputStream)
The stream will be closed once the object is written. This avoids the need for a finally clause, and maybe also exception handling, in the application code.
The stream passed in is not buffered internally within this method. This is the responsibility of your application if desired.
inputStream
- the serialized object input streamNullPointerException
- if outputStream
is null
SerializationException
- (runtime) if the serialization failspublic static Object decompressAndDeserialize(byte[] data)
data
- the blob to decompress and deserializeSerializationException
- (runtime) if the serialization failsCopyright (C) 2015-2017 The Helenus Driver Project Authors.