Comments (7)
提供一下日志,或者下载链接,你光说个下载失败我也不知道啥原因呀
from downloadx.
java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:298)
at com.north.arrow.module.common.download.core.RangeDownloader$download$3$deferred$1.invokeSuspend(RangeDownloader.kt:131)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
好像是缓冲区的问题
from downloadx.
下载链接发一下呢
from downloadx.
下载链接是公司内网的 但是浏览器可以正常下载
from downloadx.
我使用你的demo也偶尔会出现这种情况 下载停止之后继续下载返回onfailure
from downloadx.
好的
from downloadx.
`response.body()?.use {
it.byteStream().use { source ->
val tmpFileBuffer = tmpFile.mappedByteBuffer(startByte(), RANGE_SIZE)
val shadowFileBuffer = shadowFile.mappedByteBuffer(current, remainSize())
val buffer = ByteArray(8192)
var readLen = source.read(buffer)
while (isActive && readLen != -1) {
L.d("DownLoadBuffer source:${source.read()}")
L.d("DownLoadBuffer readLine:$readLen")
L.d("DownLoadBuffer remain:${end - current}")
shadowFileBuffer.put(buffer, 0, readLen)
current += readLen
tmpFileBuffer.putLong(16, current)
sendChannel.send(readLen)
readLen = source.read(buffer)
}
}
}`
看了一下这段源码 我暂停后重新读取流的时候最后一次读取的长度比remainSize还要大
DownLoadBuffer source:53
DownLoadBuffer readLine:8191
DownLoadBuffer remain:1178
是不是RangeDownLoader下载流的问题?
from downloadx.
Related Issues (20)
- 星宇牛B
- 支持断点下载不 HOT 2
- 希望能改善添加新功能
- 代码写的很好,但使用测试api和弃用的api有点接受不了,不敢用于实际项目中。
- 下载成功后仍回调多次 HOT 1
- 请问能否适配AndroidQ的下载 HOT 1
- 下载过程中断网崩溃 HOT 1
- 下载中断好几次什么时候修复一些
- 下载失败
- 是否可以自定义 Referer HOT 1
- 多任务并发下载 HOT 1
- 下载失败 HOT 5
- 重复回调问题 HOT 12
- 断点续传失败
- 能否支持Android 10 以上uri地址存储 HOT 4
- 使用GlobalScope下载时退出当前Activity下载无法继续 HOT 15
- 下载大文件时,实时进度一直不变 HOT 1
- 能否将Failed状态下的Exception传出来可以调用呢?
- When does m3U8 support, pause all, start all?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from downloadx.