FileDocCategorySizeDatePackage
BufferWrap2.javaAPI DocExample734Sun Jan 06 22:37:50 GMT 2002com.ronsoft.books.nio.buffers

BufferWrap2

public class BufferWrap2 extends Object

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

		char [] chars = new char [60];

		CharBuffer cb = CharBuffer.wrap (chars, 12, 42);

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

		cb.put ("This is a test String");

		cb.flip();

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

		cb.clear();

		cb.put ("Foobar");

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

		for (int i = 0; i < 20; i++) {
			System.out.println ("[" + i + "] = " + chars [i]);
		}