FileDocCategorySizeDatePackage
BufferMap.javaAPI DocExample670Mon Apr 22 18:40:58 BST 2002com.ronsoft.books.nio.buffers

BufferMap

public class BufferMap extends Object

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

		if (argv.length < 1) {
			System.out.println ("Need a file name");
			return;
		}

		RandomAccessFile raf = new RandomAccessFile (argv [0], "r");
		FileChannel fc = raf.getChannel();
		MappedByteBuffer buffer = fc.map (
			FileChannel.MapMode.READ_ONLY, 0, fc.size());

		buffer.clear();
		buffer.flip();

		System.out.println ("hasArray=" + buffer.hasArray());
		System.out.println (buffer.toString());

		System.out.flush();