IOException: Map Failed
大きなバイト配列を書き込もうとすると、取得します。以下の方法を使用して、バイト配列をファイルに書き込みます
private static void write(byte[] data) throws Exception {
File file = new File("C:/temp/file.json");
int length = data.length;
RandomAccessFile raf = new RandomAccessFile(file, "rw");
FileChannel fc = raf.getChannel();
MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_WRITE, 0, length);
for (int i = 0; i < length; i++) {
buffer.put(data[i]);
}
}
バイト配列は約270mbです。誰かが私が間違っていることを説明できますか?ありがとう。