FileDocCategorySizeDatePackage
BufferDupe.javaAPI DocExample828Mon May 20 00:24:24 BST 2002com.ronsoft.books.nio.buffers

BufferDupe

public class BufferDupe extends Object
Test buffer duplication. Created May 2002
author
Ron Hitchens (ron@ronsoft.com)
version
$Id: BufferDupe.java,v 1.2 2002/05/20 07:24:24 ron Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

		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);
	
private static voidprintln(java.nio.CharBuffer cb)

		System.out.println ("pos=" + cb.position() + ", limit="
			+ cb.limit() + ", capacity=" + cb.capacity()
			+ ": '" + cb + "'");