Solved

Serialization

Posted on 2002-04-02
5
294 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 127
PDFBox - convert image to PDF, PDF resolution 3 118
Image decoding from Camera 3 72
Arrays.asList  VS  ArrayList 4 45
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…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

895 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

13 Experts available now in Live!

Get 1:1 Help Now