public class SerializationUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SerializationUtils.LookAheadObjectInputStream |
| Constructor and Description |
|---|
SerializationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Serializable> |
deserializeFromBytes(Class<T> classType,
byte[] serializedObject)
Takes byte array representing serialized object and constructs its object form
|
static byte[] |
serializeToBytes(Serializable object)
Takes serializable object and serializes it to the byte array
|
public static byte[] serializeToBytes(Serializable object) throws IOException
object - object to serializeInvalidClassException - Something is wrong with a class used by serialization.NotSerializableException - Some object to be serialized does not implement the java.io.Serializable interface.IOException - Any exception thrown by the underlying OutputStream.public static <T extends Serializable> T deserializeFromBytes(Class<T> classType, byte[] serializedObject) throws IOException, ClassNotFoundException
classType - Type of the returned objectserializedObject - byte array representing serialized objectClassNotFoundException - Class of a serialized object cannot be found.InvalidClassException - Something is wrong with a class used by serialization.StreamCorruptedException - Control information in the stream is inconsistent.OptionalDataException - Primitive data was found in the stream instead of objects.IOException - Any of the usual Input/Output related exceptions.Copyright © 2017 JBoss by Red Hat. All rights reserved.