...
This means that the writeUnshared()
and readUnshared()
methods cannot be used for round-trip serialization of data structures that require a one-to-one mapping between objects preserialization and objects postdeserialization. One common example of such a data structure is a graph or network of objects that may contain reference cycles. It is also important to note that calls to the writeUnshared()
and readUnshared()
methods prevent sharing only of the object referred to by (or returned by) the methods; sharing (or not) of objects reached from references in the unshared object remains unchanged.
Consider the following code example:
...