FileDocCategorySizeDatePackage
SerialDemoObjectStream.javaAPI DocExample1054Mon Feb 16 18:17:56 GMT 2004None

SerialDemoObjectStream

public class SerialDemoObjectStream extends SerialDemoAbstractBase
Demonstrate use of standard Object Serialization.

Fields Summary
protected static final String
FILENAME
Constructors Summary
Methods Summary
public voiddump()

		ObjectInputStream is = new ObjectInputStream(
			new FileInputStream(FILENAME));
		System.out.println(is.readObject());
		is.close();
	
public static voidmain(java.lang.String[] s)


	       
		new SerialDemoObjectStream().save();	// in parent class; calls write
		new SerialDemoObjectStream().dump();	// here
	
public voidwrite(java.lang.Object theGraph)
Does the actual serialization

		// Save the data to disk.
		ObjectOutputStream os = new ObjectOutputStream(
			new BufferedOutputStream(
				new FileOutputStream(FILENAME)));
		os.writeObject(theGraph);
		os.close();