缓冲区溢出异常的原因是什么?
异常堆栈为
java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:327)
at java.nio.ByteBuffer.put(ByteBuffer.java:813)
mappedByteBuffer.put(bytes);
代码:
randomAccessFile = new RandomAccessFile(file, "rw");
fileChannel = randomAccessFile.getChannel();
mappedByteBuffer = fileChannel.map(MapMode.READ_WRITE, 0, file.length());
并致电mappedByteBuffer.put(bytes);
什么原因抛出BufferOverflowException
如何找到原因?mappedByteBuffer.put(bytes)