The javadoc documentation for every Swing class contains the warning that "Serialized objects of this class will not be compatible with future Swing releases." What exactly does this mean, and how does it affect how I write my Swing applications?

Praful Kapadia

From the JBuilder documentation:

Serializing JavaBeans

Serializing an object is the process of turning its state into a sequence of bytes that is neither a .java nor a .class file. Why would you want to do such a thing? That sequence of bytes can be saved as a file on a disk or sent over a network. When a request is made to restore an object from a file or on the other end of a network connection, the sequence of bytes is deserialized into its original structure.

For JavaBeans, serialization provides a simple way to save the state of a bean between one session and another. This is also called component persistence. For example, suppose the user of a bean changes the values of several properties. If the bean is serialized to a file and then deserializing the next time the user uses it, the bean is restored exactly as the user left it.

Sun hadn't yet decided the final format for serialized objects. I suspect when they do, they'll opt for XML format.

For now you may want to avoid serializing your objects.

[FAQ Manager Note] Sun has released the specs of the new XML serialization. See http://java.sun.com/products/jfc/tsc/articles/persistence/index.html for details

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact