aspose file tools*
The moose likes Java in General and the fly likes regarding serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "regarding serialization" Watch "regarding serialization" New topic
Author

regarding serialization

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Hi,

I have an application which make some serialized file at particular location, Now I want to read the value of that serialized file..I am aware of java deserialization process, but I am not aware of the source class which is making this serialized file, Is there any way in java , if suppose i have serialized files with me , i can serialized them and can see the contents of the serialized file..!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3578
    
  15
This describes the format of a serialized file.


Joanne
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

You could google for something like java serialization viewer. I'm sure people have written tools to do that. It wouldn't be hard to do.

In fact, what you really want is an object graph viewer. It's a two-step process: 1) Deserialize the file back into Java objects. 2) Display those objects. Step #2 is the same regardless of whether the objects came from serialization or just some arbitrary object graph you happen to pick at some point during your program.

Serialization really has nothing to do with it. The code to parse a serialized file is simply ObjectInputStream.readObject().
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Joanne Neal wrote:This describes the format of a serialized file.

http://www.javaworld.com/community/node/2915 is also a good read.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Hi Folks,

please advise me in detail, as in this case I am not aware of the java classes , which are involved in serializing process so while in the way of deserializing I not aware regarding the type casting..so is there any way that I have the serialized file with me I can see it contents only..!! please advise..!!
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Saral Saxena wrote:so is there any way that I have the serialized file with me I can see it contents only..!! please advise..!!


Sure, use a hex editor. I assume that's not what you mean though. You want to see something like:


right? Some human-readable form of the objects that have been serialized?

If so, the only way to do that, obviously, is to deserialize the objects. You don't have to use Java's built-in serialization tools to do that, but why wouldn't you? If you don't, then you just have to write the code yourself to do what they're already doing for you.

So learn how to use ObjectInputStream to read the data (the easy part) and then figure out how to represent an arbitrary object graph in a human-readable fashion (the hard part).
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38902
    
  23
You can open some serialised object files with (surprise) M$ NotePad. You can’t always see the whole object, unfortunately.
 
 
subject: regarding serialization