Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > doubt about serialization

Reply
Thread Tools

doubt about serialization

 
 
chandu
Guest
Posts: n/a
 
      02-25-2006
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

 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      02-25-2006
chandu wrote:
> 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.

--
John Bollinger
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Kevin
Guest
Posts: n/a
 
      02-25-2006
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.

 
Reply With Quote
 
Timo Stamm
Guest
Posts: n/a
 
      02-25-2006
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
 
Reply With Quote
 
John C. Bollinger
Guest
Posts: n/a
 
      02-26-2006
Kevin wrote:
> 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.)

--
John Bollinger
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to move from java object serialization to xml serialization? Dimitri Ognibene Java 4 09-02-2006 07:32 AM
doubt about doubt Bob Nelson C Programming 11 07-30-2006 08:17 PM
Object serialization XML vs java serialization plasticfloor@gmail.com Java 3 06-14-2006 03:45 AM
Serialization Problems and books on serialization? sinleeh@hotmail.com Java 8 01-02-2005 02:40 PM
avoiding XML serialization, different WSDL generation, soap serialization Ramunas Urbonas ASP .Net Web Services 1 07-27-2004 09:57 PM



Advertisments