package subPicture;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Vector;

public class Test_SerilizableHowTo {

	/*
	 * 
	 * 
// Write to disk with FileOutputStream
FileOutputStream f_out = new 
	FileOutputStream("myobject.data");

// Write object with ObjectOutputStream
ObjectOutputStream obj_out = new
	ObjectOutputStream (f_out);

// Write object out to disk
obj_out.writeObject ( myObject );
	 */
	
	/*
// Read from disk using FileInputStream
FileInputStream f_in = new 
	FileInputStream("myobject.data");

// Read object using ObjectInputStream
ObjectInputStream obj_in = 
	new ObjectInputStream (f_in);

// Read an object
Object obj = obj_in.readObject();

if (obj instanceof Vector)
{
	// Cast object to a Vector
	Vector vec = (Vector) obj;

	// Do something with vector....
}
	 */
	
	/**
	 * @param args
	 * @throws IOException 
	 * @throws ClassNotFoundException 
	 */
	public static void main(String[] args) throws IOException, ClassNotFoundException {

		// Write to disk with FileOutputStream
		FileOutputStream f_out = new 
			FileOutputStream("myobject.data");

		// Write object with ObjectOutputStream
		ObjectOutputStream obj_out = new
			ObjectOutputStream (f_out);

		// Write object out to disk
		obj_out.writeObject ( new Object() );

		//________________________________________
		
		// Read from disk using FileInputStream
		FileInputStream f_in = new 
			FileInputStream("myobject.data");

		// Read object using ObjectInputStream
		ObjectInputStream obj_in = 
			new ObjectInputStream (f_in);

		// Read an object
		Object obj = obj_in.readObject();

		if (obj instanceof Vector)
		{
			// Cast object to a Vector
			Vector vec = (Vector) obj;

			// Do something with vector....
		}
	}

}
