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 / First Aid / August 2006

Tip: Looking for answers? Try searching our database.

Java Serialization Object Size

Thread view: 
garskof@gmail.com - 07 Aug 2006 18:57 GMT
Has JDK 1.4 and 1.5 changed the encoding of String objects when
performing serialization? I seem to remember that it used to be a
serialized String occupied ((numChar * 2) + 16) bytes. Hence a four
char String was serialized as 24 bytes to disk (or memory, or
whatever). I find that with JDK 1.4 that four char String is serialized
to 11 bytes and the formula now seems to be (numChar + 7).

Has this changed, or is my memory just bad (could be). If this has
changed, did Sun document this somewhere?

--
garskof
dsjoblom@abo.fi - 07 Aug 2006 19:12 GMT
> Has JDK 1.4 and 1.5 changed the encoding of String objects when
> performing serialization? I seem to remember that it used to be a
[quoted text clipped - 5 lines]
> Has this changed, or is my memory just bad (could be). If this has
> changed, did Sun document this somewhere?

You probably remember correctly. The first figure for 1.4 sounds like
the correct amount of bytes for a serialized object wihout any special
tricks. It seems that in 1.5, strings are written with a special one
byte marker to indicate that the object is a string, the string length
(16 or 32 bits, depending on marker) + the characters encoded in utf8.

Regards,
Daniel Sjöblom


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



©2008 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.