Code example for FileChannel

Methods: read

0
		FileChannel channel = file.getChannel();
 
		/* 
		 * Perform a single read using NIO. 
		 */ 
		channel.read(readBuffer, offset);
	} 
 
	protected int writeToFile(RandomAccessFile file, ByteBuffer data,
			long destOffset) throws IOException, DatabaseException {
 
		FileChannel channel = file.getChannel();
 
		/* 
		 * Perform a single write using NIO. 
		 */ 
		return channel.write(data, destOffset);
 
	} 
}