Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Eclipse have an editor/viewer for java serialized files?

I'm serializing my objects with ObjectOutputStream(FileOutputStream(File)) and deserializing them with the analogous InputStreams. Is there a way to look inside of these serialized files (in eclipse preferably), so I can check, if all necessary attributes were written?

edit: google search was negative

like image 896
kulpae Avatar asked Feb 03 '11 17:02

kulpae


People also ask

What is a serialized file in Java?

To serialize an object means to convert its state to a byte stream so that the byte stream can be reverted back into a copy of the object. A Java object is serializable if its class or any of its superclasses implements either the java. io. Serializable interface or its subinterface, java.

Which method is used to serialize an object to open?

Serialization is performed by method writeObject() of the ObjectOutputStream class. Deserialization is performed by the readObject() of the ObjectInputStream class. These serialization methods are in the java.io package.

Where are serialized objects stored Java?

The serialized objects are stored in the file "nameStore", like the code specifies. Where that file is created depends on what the default directory is when this code is run.


2 Answers

Write some tests (using Eclipse's built-in JUnit support).

The only way to "look inside" these files is to use ObjectInputStream(FileInputStream(File)), unless you're a bytecode guru and use a hex editor. If you actually have some testing, there is no need to "look inside" anything.

like image 170
OrangeDog Avatar answered Oct 11 '22 19:10

OrangeDog


While this isn't a full fledged editor, Eamonn McManus has written a transcoder which deciphers a serialized blob into a human readable form. http://weblogs.java.net/blog/2007/06/12/disassembling-serialized-java-objects

If binary compatibility and performance are considerations, this would be a good time to look into Externalizable instead of Serializable.

like image 24
Ron Avatar answered Oct 11 '22 19:10

Ron