Programming Tips - Can I do mmap() on Android with Java?

Date: 2012feb17 OS: Android Language: Java Q. Can I do mmap() on Android with Java? A. You can use the MemoryFile to make a file in memory. Or to make a read-only in-memory view of a file:
RandomAccessFile rac = new RandomAccessFile("myfilename", "r"); FileChannel channel = rac.getChannel(); MappedByteBuffer mbb = channel.map(MapMode.READ_ONLY, 0, 1024); // Bulk-get some bytes bytes = new bytes[100]; mbb.get(bytes, 300, 100);