ObjectInputStream Example
Here is a Java ObjectInputStream example:
ObjectInputStream objectInputStream =
new ObjectInputStream(new FileInputStream("object.data"));
MyClass object = (MyClass) objectInputStream.readObject();
//etc.
objectInputStream.close();
For this ObjectInputStream example to work the object you read must be an instance of MyClass, and must have been serialized into the file "object.data" via an ObjectOutputStream.
Before you can serialize and de-serialize objects the class of the object must implement java.io.Serializable. For more info, see Java Serializable.



