Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Serialization

Posted on 2002-04-02
5
Medium Priority
?
301 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
 

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 200 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

610 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