Solved

Serialization

Posted on 2002-04-02
5
293 Views
Last Modified: 2010-03-31
What is Object Serialization..??
What exactly happens when we serialize objetcs..and when to use serialization of objects.
0
Comment
Question by:yrrm
5 Comments
 
LVL 3

Expert Comment

by:msterjev
ID: 6915254
0
 

Author Comment

by:yrrm
ID: 6962102
No explanation was provided and the sites suggested by the expert was not helpfull to me.
0
 

Accepted Solution

by:
robin_at_mri earned 50 total points
ID: 7784361
I am learning O.S. myself right now but here is what I have come up with so far.  Object Serialization is a STANDARDIZED way to save an object.  Each object basically has all of it's primitives stored and then the member objects are stored based on their primitives and so on.  The file structure I am sure is organized in a less than linear fashion.  Once an object is serialized once, only a reference to it gets serialized after that.  Also you can specify what variables get serialized, if you call a variable "transient" then it will be ignored by the serializer.  Each object is converted to a stream of bytes on the simplest level that is then stored in a "Stream" which is more or less like a pipe that will spit the bytes back out, either to a file, or over a socket, etc. etc.  So you could store something by a line like
s.writeObject(myCustomObject); which would write out all of the details of the object as a sequence of bytes.  Each object is prefixed by a class declaration that says what type of class it is.  This declaration is based on a variable called serialVersionUID.  i.e.

static long serialVersionUID = 200320032003200301L;


This is a unique id for the class.  If you do not specify manually a new one will be created randomaly each time you serialize a class.  OS is so cool because all you have to do is to say s.writeObject(myClass); and all of the work is done for you.  Am still learning, have you learned much more about this since you posted to the exchange?


Rob
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7932655
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: robin_at_mri
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7984172
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now