It is quite simple to do it, you write the object down to file, then you read it:
My questions are
Thanks
The answer is in the page you linked to:
Note that the alias is a key that is stored with the class instance and links the class definition with the specific object that is stored in the ByteArray when an instance of that object is serialized. This key can be any unique string identifying this class, but convention is to use the fully normalized package and class name.
That's why you get a generic object if you omit the alias - the deserialization method does not know what to do with the data, unless you specify to which class the values should be mapped.
Yes, there is: registerClassAlias() does the same thing. But the metadata tag is much prettier to read ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With