异常堆栈是
java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:327)
at java.nio.ByteBuffer.put(ByteBuffer.java:813)
mappedByteBuffer.put(bytes);
Run Code Online (Sandbox Code Playgroud)
代码:
randomAccessFile = new RandomAccessFile(file, "rw");
fileChannel = randomAccessFile.getChannel();
mappedByteBuffer = fileChannel.map(MapMode.READ_WRITE, 0, file.length());
Run Code Online (Sandbox Code Playgroud)
并打电话 mappedByteBuffer.put(bytes);
是什么原因 mappedByteBuffer.put(bytes)抛出BufferOverflowException
如何查找原因?