Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When objects are being serialized using the writeObject() method, if the same object is encountered more than once then , it is written to the output stream only once, and , after the first occurrence, only a reference to the first occurrence is written to the stream. CorrespondlinglyCorrespondingly, the readObject() method resolves references written by writeObject() to multiple occurrences of the same object.

Wiki Markup
On the other hand, according According to the Java API \[[API 2006|AA. References#API 06]\], the {{writeUnshared()}} method:

Writes writes an "unshared" object to the ObjectOutputStream. This method is identical to writeObject, except that it always writes the given object as a new, unique object in the stream (as opposed to a back-reference pointing to a previously serialized instance).

Correspondingly, the readUnshared() method:

Reads reads an "unshared" object from the ObjectInputStream. This method is identical to readObject, except that it prevents subsequent calls to readObject and readUnshared from returning additional references to the deserialized instance obtained via this call.

...

This compliant solution overcomes the problem of the NCCEnoncompliant code example.

Code Block
bgColor#ccccff
// need some code here

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="be683bdfbcef90b7-f41ec671-48714b18-a57ab0c8-bfd9ff9e5b7c709a747c23fe"><ac:plain-text-body><![CDATA[

[[API 2006

AA. References#API 06]]

[Class ObjectOutputStream

http://download.oracle.com/javase/6/docs/api/java/io/ObjectOutputStream.html] and [Class ObjectInputStream

http://download.oracle.com/javase/6/docs/api/java/io/ObjectInputStream.html]]]></ac:plain-text-body></ac:structured-macro>