Program to decode serialized data?
Is there a program around which displays the contents of a serialized data stream? Because I'm having a bit of difficulty in serializing some highly interlinked objects, and I suspect that a class is being serialized which shouldn't be. It would be good just to have a quick look at what objects are in the output file.
I've seen the spec, and should obviously write a one-off program to do the decoding, but if there's something out there already it would save a lot of time.
I tried doing a loop with
Object o=objectInputStream.readObject();
but it complained that the UIDs were wrong. Which of course was true.
[649 byte] By [
ptoyea] at [2007-11-26 16:39:43]

# 1
If you were to System.out.println(objectInputStream.readObject();
in your loop instead of assigning it to an object, does/will it still generate the UID error?
I don't know of a program to do what you want, but I do know a tedious way to get around the UID error. When it gives you the error, copy down the UID number of the file, then go over to the class and declare private static final long serialVersionUID = /*the UID of the file followed by an L*/
I feel like it's almost a hack, but it will stop the UID mismatch, and you won't have to worry about it again. (I think. It worked for me when I had UID issues and realized it was because I wasn't declaring serialVersionUID like I should have been.)
kazea at 2007-7-8 23:06:35 >

# 3
> I'm not sure whether your code hack is worse than
> writing a program to do the decoding
If you mean putting the UID where it should have been all the time, no this is not a hack, it is something you have to do anyway. Then the program to decode the stream is just the one-liner he posted above.
ejpa at 2007-7-8 23:06:35 >
