Class SerializationUtils
- java.lang.Object
-
- org.jboss.arquillian.drone.webdriver.factory.remote.reusable.SerializationUtils
-
public class SerializationUtils extends Object
The utility methods for serializing / deserializing objects- Author:
- Lukas Fryc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSerializationUtils.LookAheadObjectInputStream
-
Constructor Summary
Constructors Constructor Description SerializationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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
-
-
-
Method Detail
-
serializeToBytes
public static byte[] serializeToBytes(Serializable object) throws IOException
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.
-
-