File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Object Serialization Process? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Object Serialization Process?" Watch "Object Serialization Process?" New topic

Object Serialization Process?

scott miles
Ranch Hand

Joined: Jun 16, 2011
Posts: 70
Object serialization is the process of saving an object's state to a sequence of bytes.
Does it saves only the instance variable or also the object methods(like getter and setter methods) ?
Once we we write the object to outputstream or some text file how does it get transmitted over network?
Do we write the object in a text file right?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Serialization is just about data, not methods. Also, static data is not included, since that is class behavior, not object behavior.

Whether it's a text file or a binary file depends on the method of serialization. In the Java world, most commonly it refers to binary serialization using the Object[In|Out]putStream classes. But if the objects conform to the JavaBeans standard, it's also possible to use the XML[En|De]coder classes, which produce a textual representation in XML.
Darryl Burke

Joined: May 03, 2008
Posts: 5115

Hi scott and welcome to the Ranch! We don't have too many rules here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link:
subject: Object Serialization Process?
jQuery in Action, 3rd edition