package test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import test.choice.A;

public class TrySerializer {
	static public void main(String[]args) throws Exception
	{
		A a = test.choice.ChoiceFactory.INSTANCE.createA();
		a.setA("aaa");
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		ObjectOutputStream oos = new ObjectOutputStream(bos);
		oos.writeObject(a);
		oos.flush();
		oos.close();
		ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
		ObjectInputStream ois = new ObjectInputStream(bis);
		Object o = ois.readObject();
		a = (A)o;
		System.out.println(o);
		
		
		
	}
}
