创建一个只读的内存映射文件
import java.io.File; import java.io.IOException; /**来自 NowJava.com - 时代Java**/ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class Main { public void main(String[] argv) { try { File file = new File("filename"); // Create a read-only memory-mapped file FileChannel roChannel = new RandomAccessFile(file, "r").getChannel(); ByteBuffer roBuf = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, (