CharBuffer buffer = CharBuffer.wrap ("01234567"); buffer.position (3).limit (6).mark().position (5); CharBuffer dupeBuffer = buffer.duplicate(); buffer.clear(); println (buffer); println (dupeBuffer); dupeBuffer.reset(); println (dupeBuffer); dupeBuffer.clear(); println (dupeBuffer);
System.out.println ("pos=" + cb.position() + ", limit=" + cb.limit() + ", capacity=" + cb.capacity() + ": '" + cb + "'");