Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

doubt about serialization

Thread view: 
chandu - 25 Feb 2006 07:44 GMT
why objects are to be serialized ,when we want to put them on
stream.cont we pass them as byte by byte as other types
John C. Bollinger - 25 Feb 2006 09:02 GMT
> why objects are to be serialized ,when we want to put them on
> stream.cont we pass them as byte by byte as other types

That's more or less what serialization is.  Java's built-in
serialization does have some very nice additional behavior when it comes
to objects that hold references to other, shared objects, however, in
that the deserialized versions refer to one common copy of the original
instead of to different ones.  That can in fact be very important for
correctness.  The built-in serialization mechanism also handles all the
details automatically, for any Serializable type, so that you don't have
to write custom serialization code for most types of object you want to
transfer.

Signature

John Bollinger
jobollin@indiana.edu

Kevin - 25 Feb 2006 10:08 GMT
But if I remember it well, it will be very slow if there are many
reference among the objects. Java will check the reference among the
objects and write that information out as well.
In one project, I ended up writing my own code for that, which speeded
up 10x.
Timo Stamm - 25 Feb 2006 20:00 GMT
Kevin schrieb:
> But if I remember it well, it will be very slow if there are many
> reference among the objects. Java will check the reference among the
> objects and write that information out as well.
> In one project, I ended up writing my own code for that, which speeded
> up 10x.

You can use the transient attribute for members that are cheap to
rebuild, but expensive to serialize.

Timo
John C. Bollinger - 26 Feb 2006 02:14 GMT
> But if I remember it well, it will be very slow if there are many
> reference among the objects. Java will check the reference among the
> objects and write that information out as well.
> In one project, I ended up writing my own code for that, which speeded
> up 10x.

Naturally, if you can make use of knowledge about the details of the
objects being serialized then there is opportunity to improve on the
speed of Java's built-in mechanism.  On the other hand, I have trouble
believing that you achieved across-the-board 1000% speedup for general
serializable objects, if indeed your method was generally applicable at
all.  (Assuming always that it worked correctly in the first place; I'm
sure you're satisfied that it did.)

Signature

John Bollinger
jobollin@indiana.edu



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.