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?

War es hilfreich?

Lösung

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.

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
scroll top