aspose file tools*
The moose likes Java in General and the fly likes Serializing a class in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serializing a class in Java" Watch "Serializing a class in Java" New topic
Author

Serializing a class in Java

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 417
I know we can serialize a class if that class implements Serializable/Externalizable interface. But, if a class doesn't implement any of these interfaces, can we still serialize that class in java. If Yes, please tell how.

Thanks in advance.

--Raj
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
You can't, at least not through the binary mechanism using Object[In|Out]putStream. If the class follows JavaBean conventions you can use the java.beans.XMLEncoder/XMLDecoder classes , though.

As as aside, classes are not serialized, objects are.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serializing a class in Java
 
Similar Threads
doubt in serializatiion
Serialization
difference between exe file and batch file
XML serialization
Java Object - XML