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.
Get all serialized fields in Externalizable class
-
29-06-2022 - |
Frage
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?
Lösung
Andere Tipps
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.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow