Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: removed wierdly specific but tangential paragraph

...

Code Block
bgColor#FFCCCC
final class Dup {
  CharBuffer cb;
 
  public Dup() {
    cb = CharBuffer.allocate(10);
    // Initialize
  }

  public CharBuffer getBufferCopy() {	
    return cb.duplicate();
  }
}

When the CharBuffer created by the duplicate() method is based on a CharBuffer returned by the wrap() method, modifying the CharBuffer returned by the duplicate() method also modifies the contents of the backing char array.

Compliant Solution (asReadOnlyBuffer())

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4766bee712463e59-b15d5503-45424cd7-a3e7a9b6-a1131276be8525754a58c9e0"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

class CharBuffer

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="435c4c5efa307cea-9d2e720f-449c4f84-b5bead27-bcd76f78b94ff3885792b0a4"><ac:plain-text-body><![CDATA[

[[Hitchens 2002

AA. Bibliography#Hitchens 02]]

2.3 Duplicating Buffers

]]></ac:plain-text-body></ac:structured-macro>

...