FileDocCategorySizeDatePackage
SerializationTest.javaAPI DocAndroid 1.5 API1605Wed May 06 22:42:02 BST 2009com.android.unit_tests

SerializationTest

public class SerializationTest extends TestCase
Tests serialization of user-level classes.

Fields Summary
Constructors Summary
Methods Summary
public voidtestSerialization()

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(bout);
        oout.writeObject(new MySerializable());
        oout.close();

        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
        Object o = new ObjectInputStream(bin).readObject();
        assertTrue(o instanceof MySerializable);