Class SerializationUtils
java.lang.Object
org.jboss.arquillian.drone.webdriver.factory.remote.reusable.SerializationUtils
The utility methods for serializing / deserializing objects
- Author:
- Lukas Fryc
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Serializable>
TdeserializeFromBytes(Class<T> classType, byte[] serializedObject) Takes byte array representing serialized object and constructs its object formstatic byte[]serializeToBytes(Serializable object) Takes serializable object and serializes it to the byte array
-
Constructor Details
-
SerializationUtils
public SerializationUtils()
-
-
Method Details
-
serializeToBytes
Takes serializable object and serializes it to the byte array- Parameters:
object- object to serialize- Returns:
- the byte array representing serializable object
- Throws:
InvalidClassException- 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.
-
deserializeFromBytes
public static <T extends Serializable> T deserializeFromBytes(Class<T> classType, byte[] serializedObject) throws IOException, ClassNotFoundException Takes byte array representing serialized object and constructs its object form- Parameters:
classType- Type of the returned objectserializedObject- byte array representing serialized object- Returns:
- deserialized object
- Throws:
ClassNotFoundException- 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.
-