Không có bản hack nào khả dụng trong Android.
Nhưng có một vài người giúp đỡ và đoạn mà làm cho C-Java bắt buộc đối với các file mmap dễ dàng/dễ dàng hơn:
Xem util-mmap trong hành động, thực sự dễ dàng:
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));
}
}
}
Dưới đây là lý do của câu hỏi này: http: //stackoverflow.com/questions/38293892/java-mmap-fails-on-android-with-mmap-failed-enomem-out-of-memory – Karussell