SerializationUtil

public class SerializationUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.SerializationUtil


Utility to serialize/deserialize an object that implements ERROR(/Serializable).

Summary

Public constructors

SerializationUtil()

Public methods

static Object deserialize(String serialized)

Deserialize an object that was serialized using serializeToString(Serializable).

static Object deserialize(File serializedFile, boolean deleteFile)

Deserialize an object that was serialized using serialize(Serializable).

static File serialize(Serializable o)

Serialize a object that implements ERROR(/Serializable).

static String serializeToString(Serializable o)

Serialize and object into a base64 encoded string.

Public constructors

SerializationUtil

public SerializationUtil ()

Public methods

deserialize

public static Object deserialize (String serialized)

Deserialize an object that was serialized using serializeToString(Serializable).

Parameters
serialized String: the base64 string where the object was serialized.

Returns
Object the Object deserialized.

Throws
if the deserialization fails.

deserialize

public static Object deserialize (File serializedFile, 
                boolean deleteFile)

Deserialize an object that was serialized using serialize(Serializable).

Parameters
serializedFile File: the file where the object was serialized.

deleteFile boolean: true if the serialized file should be deleted once deserialized.

Returns
Object the Object deserialized.

Throws
if the deserialization fails.

serialize

public static File serialize (Serializable o)

Serialize a object that implements ERROR(/Serializable).

Parameters
o Serializable: the object to serialize.

Returns
File the ERROR(/File) where the object was serialized.

Throws
if serialization fails.

serializeToString

public static String serializeToString (Serializable o)

Serialize and object into a base64 encoded string.

Parameters
o Serializable: the object to serialize.

Returns
String the String where the object was serialized.

Throws
if serialization fails.