What is the cause of BufferOverflowException?

前端 未结 2 1124
太阳男子
太阳男子 2021-02-18 17:02

The exception stack is

java.nio.BufferOverflowException
     at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:327)
     at java.nio.ByteBuffer.put(By         


        
2条回答
  •  逝去的感伤
    2021-02-18 17:46

    Supposedly because your byte array is bigger then the buffer.

    put(byte [] bytes)

    I'd go by checking your file.length() and make sure that your memory buffer can actually be written.

提交回复
热议问题