ssseasonnn / RxDownload

A multi-threaded download tool written with RxJava and Kotlin
Apache License 2.0
4.14k stars 612 forks source link

断点下载出现BufferOverflowException错误 #330

Open fxlcy opened 3 years ago

fxlcy commented 3 years ago

RangeDownloader文件 shadowFileBuffer.put(buffer, 0, readLen)可能会出现该问题

解决方法 shadowFileBuffer.put(buffer, 0, readLen)之前加上

if (readLen > shadowFileBuffer.remaining()) { val size = shadowChannel.size() val newFileBuffer = shadowChannel .map(READ_WRITE, current, size) shadowFileBuffer = newFileBuffer }