FileDocCategorySizeDatePackage
BufferSlice.javaAPI DocExample887Wed May 08 18:38:12 BST 2002com.ronsoft.books.nio.buffers

BufferSlice

public class BufferSlice extends Object
Test buffer slice. Created May 2002
author
Ron Hitchens (ron@ronsoft.com)
version
$Id: BufferSlice.java,v 1.1 2002/05/09 01:38:13 ron Exp $

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

		CharBuffer buffer = CharBuffer.allocate (8);
		buffer.position (3).limit (5);
		CharBuffer sliceBuffer = buffer.slice();

		println (buffer);
		println (sliceBuffer);

		char [] myBuffer = new char [100];
		CharBuffer cb = CharBuffer.wrap (myBuffer);

		cb.position(12).limit(21);

		CharBuffer sliced = cb.slice();

		println (cb);
		println (sliced);
	
private static voidprintln(java.nio.CharBuffer cb)

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