Make the fields that point to non serializable objects transient and
implement the readObject method to reinitialize them. There is a good
article (SERIALIZATION IN THE REAL WORLD) about serialization in:

http://developer.java.sun.com/servlet/PrintPageServlet?url=http%3A//develope
r.java.sun.com/developer/TechTips/2000/tt0229.html

Pasi

-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of RWGRAY
Sent: 11. helmikuuta 2002 0:37
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Serialization


I created a class which implements Serializable.

Doesn't this mean that I can use writeObject() to write out an instance of
the class to a file even if the class has variables defined which point to
objects which are *not* serializable?

In my case, I have defined a variable of type BranchGroup.  BranchGroup does
not implement Serializable.

I thought for non-serializable variables that the Java system would simply
set these to null and continue to write out the rest of the object's
variables values; those that are associated with serializable objects.  Then
on input, it would be up to the programmer to re-establish appropriate
values for the non-serializable variables.

But I get java.io.NotSerializableException: javax.media.j3d.BranchGroup.

Can someone clue me in on what's going on?

Thanks,
Bob Gray

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to