Solved

Serialization

Posted on 2002-04-02
5
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 48
How do I remove an object from a 3 53
Adding multiple JVM environments to RedHat 6 7 69
Selenium docs api java index 3 68
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

733 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