请教序列化对象的问题!
郭海涛 2003-10-21 04:12:21
//保存对象状态
public void writeObject(String file)
{
FileOutputStream fo=null;
ObjectOutputStream so=null;
try{
fo=new FileOutputStream(file);
so=new ObjectOutputStream(fo);
so.writeObject(this.toString());
}catch(FileNotFoundException e )
{
System.out.println(e);
}catch(IOException e )
{
System.out.println(e);
}finally
{
try
{
so.close();
}catch(IOException e){}
}
}
//实现
Employee emp= new Employee(name,ID,gender);//设置序列化对象的值
emp.writeObject("employee_obj.ser");
我的问题:
这样的实现结果每次都删掉了以前保存的序列化对象,我想append序列化对象
怎么改呀?