Dave's Brain

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

Date: 2012feb17
Platform: 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);

Add a comment

Sign in to add a comment
Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.