Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages
Started by George
Mon, 16 Dec 2002 20:23
Trouble reading back a serialized object
Author: George
Date: Mon, 16 Dec 2002 20:23
Date: Mon, 16 Dec 2002 20:23
14 lines
1377 bytes
1377 bytes
My class has two sets of data members: a protected TreeMap and a bunch of protected final Strings. I want only the TreeMap object to be serialized. However the TreeMap contains entries for which the Strings are the keys. In debugging the readObject method I find that whenever this method has been called the protected String members of the class always get set to null (even tho they are declared final and initialized in the declaration statement). Why is this happening? What am I doing wrong? Thanks.
Re: Trouble reading back a serialized object
Author: John McGrath TeamB
Date: Mon, 16 Dec 2002 21:22
Date: Mon, 16 Dec 2002 21:22
21 lines
1510 bytes
1510 bytes
On Mon, 16 Dec 2002 16:06:59 -0500, George wrote:
> > Does your readObject() method call the defaultReadObject()
> > method on the ObjectInputStream passed to it?
> No it doesn't. Should it?
Yes. That is what will set those String values.
Here is a some useful information on serialization:
http://java.sun.com/docs/books/tutorial/essential/io/serialization.html
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads