This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serilalization process

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was going through process of serilaization in java and done lots of googling also , I just want to know the .ser file that is created after the succesfull serialization process in which we say we have persisted the object state and we try to open it let say in notepad we can able to understand that since it is in encrypted format, if we try to open that .ser file in any hexadecimal editor will we able to see it' contents...? and if not then How we would be able to see it contents ..?


please explain the real time situation where we can prove that serialation is the only solution and it had impacted the performance in terms of efficiency..!!


 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15281
39
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you serialize objects using Java's standard serialization mechanism, the objects will be stored in a binary format that you cannot read with a text editor such as Notepad. It is not encrypted; it's just not in text format. You can later deserialize the objects again with some Java code.

Advantages of serialization is that it is easy to do in Java, that it's reasonably efficient, and that it's a compact binary format (compare it to for example XML, which is a very verbose format - an XML file containing the same information will be many times larger than a serialized binary file).

Disadvantages are that the exact file format is not a standard format (you can find the specification here) which means it is very difficult to work with in non-Java environments, and it ties your code very tightly to the content of the serialized file, which means that if you make changes in your source file (for example adding or removing member variables to or from a class), there's a big chance that your new code cannot read old serialized files anymore.

For that last reason, it is often much better to use a standard and extensible file format that is less tightly tied to your source code instead of Java serialization. There are a number of efficient, compact, binary formats that can be used as an alternative to serialization, for example Google Protocol Buffers, BSON, Apache Avro and others. All of those require you to include extra libraries in your project and are not as easy to use as standard Java serialization.
 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the expnation ..is there any editior in which I can open that .ser file (serialized file) and can read the object instance state , although I can do this by de seririalization process also but I want to open .ser file ...??
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saral Saxena wrote:Thanks for the expnation ..is there any editior in which I can open that .ser file (serialized file) and can read the object instance state , although I can do this by de seririalization process also but I want to open .ser file ...??

Why? Unless you want to do this for nefarious reasons, the easiest way by far for you to "read" it is to deserialize the contents and print them out.

Winston
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Believe it or not, you can read some of the information in a .ser file with a text editor.
 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was looking for an alternative of deserialization..!!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15281
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, but is there a special reason why you need this? Do you have some files with serialized objects that you can't read anymore because you don't have the original classes anymore and now you need to somehow rescue the data?

This might be useful: Question: GUI tool to browse Java serialized objects?.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic