Re: Serialization problem
- From: Thomas Fritsch <i.dont.like.spam@xxxxxxxxxxx>
- Date: Mon, 26 Feb 2007 14:18:58 GMT
TonyB schrieb:
I'm writing an object to a file using serialisation. I based it on an example from the netWhat output did you get here? Post the complete printed stack trace!
public void writeMyObject(){
FileOutputStream fos = null;
ObjectOutputStream out = null;
try
{
fos = new FileOutputStream("test.dat");
out = new ObjectOutputStream(fos);
out.writeObject(myObject);
out.close();
System.out.println("Object Persisted");
}
catch(IOException ex)
{
ex.printStackTrace();
}Without the information contained the exception trace (see above) I can only guess, but i don't want to.
myObject class has implements Serializable in its declaration.
What happens is I get a IOException when executing out.writeObject(myObject);
What may cause this ?, and are there any further tests I can do to find out the problem ?
Btw the file is created, but not closed properly.
--
Thomas
.
- Follow-Ups:
- Re: Serialization problem
- From: TonyB
- Re: Serialization problem
- References:
- Serialization problem
- From: TonyB
- Serialization problem
- Prev by Date: Re: How do you consistently repaint a JComponent?
- Next by Date: Re: How do you consistently repaint a JComponent?
- Previous by thread: Serialization problem
- Next by thread: Re: Serialization problem
- Index(es):