We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
小文件下载时没有问题,但是大文件下载时,进度会卡主不动,过一会报错:
06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: java.net.ProtocolException: unexpected end of stream 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at okhttp3.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:384) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:50) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at okio.ForwardingSource.read(ForwardingSource.java:35) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at com.yuan.leopardkit.download.model.DownLoadResponseBody$1.read(DownLoadResponseBody.java:74) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at okio.RealBufferedSource$1.read(RealBufferedSource.java:371) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at java.io.InputStream.read(InputStream.java:162) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at com.yuan.leopardkit.download.task.DownLoadTask.writeCache(DownLoadTask.java:137) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at com.yuan.leopardkit.download.DownLoadManager.writeCache(DownLoadManager.java:74) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at com.yuan.leopardkit.download.task.DownLoadHelper$4$1.onResponse(DownLoadHelper.java:164) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 06-29 14:22:41.983 11015-11937/cn.yuan.leopard W/System.err: at java.lang.Thread.run(Thread.java:841)
推测是因为这段代码长时间阻塞引起的:
randomAccessFile = new RandomAccessFile(file, "rwd"); channelOut = randomAccessFile.getChannel(); MappedByteBuffer mappedBuffer = channelOut.map(FileChannel.MapMode.READ_WRITE, downloadInfo.getBreakProgress(), downloadInfo.getFileLength()-downloadInfo.getBreakProgress());`
找一个200MB大小的文件试一试就知道了,MappedByteBuffer会首先创建一个200MB的文件,这个过程会引起阻塞
The text was updated successfully, but these errors were encountered:
No branches or pull requests
小文件下载时没有问题,但是大文件下载时,进度会卡主不动,过一会报错:
推测是因为这段代码长时间阻塞引起的:
找一个200MB大小的文件试一试就知道了,MappedByteBuffer会首先创建一个200MB的文件,这个过程会引起阻塞
The text was updated successfully, but these errors were encountered: