File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes serilalization process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "serilalization process " Watch "serilalization process " New topic
Author

serilalization process

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

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

Joined: Mar 17, 2011
Posts: 7486
    
  18

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


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
Believe it or not, you can read some of the information in a .ser file with a text editor.
Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

I was looking for an alternative of deserialization..!!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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?.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: serilalization process
 
Similar Threads
how to look for jar file content in linux?
Serialization & data retrieval
Cobertura report & Websphere help
Is there a way to open .ser file?
whats with foo.ser? (in regarrds with serialization)