Hello,
I have a simple data structure which is serialized and deserialized. Upon deserialization, I wish that the data structure itself makes a subsequent processing step. In our case, it should simply call String.intern() on all the strings it contains.
Preemptive answers to unrelated questions:
Why don't you simply do this after normally deserializing the object?
- This object is serialized/deserialized in a lot of places
- This data structure is part of bigger objects which are serialized/deserialized, so you would have to browse any encapsulating object after deserialization as well
- Other developpers using the framework might not be aware or forget this step, and would result in a huge bug magnet
- It would be ugly
Why do you use String.intern() in the first place?
For performance reasons. We do massive text processing and computation requiring this.
In other words, in:
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
Is there a way to invoke the default/standard deserialization inside? (So that we can just add our little step afterwards)
Thanks!
Arnaud