Code Monkey home page Code Monkey logo

Comments (7)

ssseasonnn avatar ssseasonnn commented on June 30, 2024

提供一下日志,或者下载链接,你光说个下载失败我也不知道啥原因呀

from downloadx.

Travellingpoet avatar Travellingpoet commented on June 30, 2024

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.

ssseasonnn avatar ssseasonnn commented on June 30, 2024

下载链接发一下呢

from downloadx.

Travellingpoet avatar Travellingpoet commented on June 30, 2024

下载链接是公司内网的 但是浏览器可以正常下载

from downloadx.

Travellingpoet avatar Travellingpoet commented on June 30, 2024

我使用你的demo也偶尔会出现这种情况 下载停止之后继续下载返回onfailure

from downloadx.

ssseasonnn avatar ssseasonnn commented on June 30, 2024

好的

from downloadx.

Travellingpoet avatar Travellingpoet commented on June 30, 2024

`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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.