I have several Externalizable classes. How can I write a method that returns all fields that are serialized? Alternatively, how can I determine which fields have been serialized?
Asked
Active
Viewed 81 times
0
-
what is an `Externalizable class`? – Philipp Sander Sep 20 '13 at 13:11
-
@PhilippSander presumably one of [these](http://docs.oracle.com/javase/7/docs/api/java/io/Externalizable.html). – Boris the Spider Sep 20 '13 at 13:12
-
You need to read the writeExternalizable for the class. – Peter Lawrey Sep 20 '13 at 13:22
2 Answers
0
How to write a method that returns all fields are serialized, or how to know what field was been serialized
The only way to know what writeExternalizable wrote is the read the code for writeExternalizable, or you assume that readExternalizable is written correctly and count the number of fields read.
In short, you cannot read something which was not written.

Peter Lawrey
- 525,659
- 79
- 751
- 1,130
0
The difference between Serializable
and Externalizable
classes is that Externalizable
classes have the freedom to store their data in any format they like. In other words, there doesn’t have to be a correlation between instance fields and the stored data in the way you think.

Holger
- 285,553
- 42
- 434
- 765