Nie ma hackowania pod Androidem.
Ale istnieje kilka pomocników i fragmenty, które sprawiają, wiązanie C-Java dla mmap plików łatwy/łatwiejsze:
Patrz util-mmap w działaniu, bardzo proste:
public class MMapTesting {
public static void main(String[] args) throws IOException {
File file = new File("test");
MMapBuffer buffer = new MMapBuffer(file, 0, 1000, FileChannel.MapMode.READ_WRITE, ByteOrder.BIG_ENDIAN)) {
buffer.memory().intArray(0, 100).set(2, 234);
// calls unmap under the hood
buffer.close();
// here we call unmap automatically at the end of this try-resource block
try (MMapBuffer buffer = new MMapBuffer(file, FileChannel.MapMode.READ_WRITE, ByteOrder.BIG_ENDIAN)) {
System.out.println("length: " + buffer.memory().length());
IntArray arr = buffer.memory().intArray(0, buffer.memory().length()/8);
// prints 234
System.out.println(arr.get(2));
}
}
}
Oto przyczyna tego pytania: http: //stackoverflow.com/questions/38293892/java-mmap-fails-on-android-with-mmap-failed-enomem-out-of-memory – Karussell