Comments (3)
Good questions:
How to set network thread count?
DownloadDispatcher.setMaxParallelRunningCount(int)
How to set My Own task id Generation Function?
As I know this feature is just for "replace URL for the case of old URL is discard but its data still resumable", so, because of FileDownloader isn't provide database interface, so you can't change the URL saved on the database, so we have to use like idGenerator
to handle this case.
But good news on okdownload, it supports edit database, so for that feature, you can easily handle like under way:
final BreakpointStore store = OkDownload.with().breakpoint();
final BreakpointInfo oldTaskInfo = store.get(id);
final DownloadTask newTask = new DownloadTask.Builder(newUrl, file).build();
final newInfo = oldTaskInfo.copyWithReplaceIdAndUrl(newTask.getId(), newUrl);
store.createAndInsert(task);
store.update(newInfo);
store.remove(id);
// then newTask with newUrl will reuse proceed on the oldTaskInfo
newTask.enqueue(listener);
task.pause Callback is missing?
You can use DownloadTask#cancel
instead of task.pause
, mostly it is the same to the task.pause
, and if you have a bunch of tasks need to be paused, please use DownloadTask.cancel(tasks)
it has high performance to handle the bunch of tasks.
from task object how to get download size and total size?
I think if you just cast a glance at the sample project, you knew that.
On the FileDownloader the reuse
and cache too many references on task are very bad practice because it let task become time sense, we have to handle the complex case of references on the task is changed, and raise tons of bugs for it.
So, on the okdownload, the task will force on its profile.
But we also provide many convenient ways for you to cache download size or total size. the normal case is you can get them from DownloadListener
or its BreakpointInfo
(because you can touch database data BreakpointInfo
and you also can get its data reference on the database from OkDownload.with().breakpoint().get(id)
or from DownloadListener
callback, so you can get those size from it); but you also can use DownloadTask#addTag
or DownloadTask#setTag
to cache it to the DownloadTask
each time on callbacks of DownloadListener
, then get them from DownloadTask#getTag
.
from okdownload.
Thanks .... for responce
from okdownload.
can okDownload really pause a task?
pause means that progress can continue after resume.
cancel means task restart after resume.
from okdownload.
Related Issues (20)
- is OkDownload support config custom Executor?
- 断点下载的判断为什么没有使用If-Range呢 HOT 1
- 下载超过2G多大文件时,杀进程后,再次下载无法断点续传。 HOT 2
- 报错啦,求大佬支援 HOT 2
- The current offset on block-info isn't update correct, 104466100 != 106391228 on 3
- The current offset on block-info isn't update correct, 104466100 != 106391228 on 3 HOT 14
- 当文件存在时,如何覆盖当前文件下载 HOT 2
- How do I download and run this ? HOT 1
- TaskEnd while EachBlockProgress not always called
- 如何在杀了应用后,可以断点续传下载
- java.lang.IllegalStateException: The current store is com.liulishuo.okdownload.core.breakpoint.BreakpointStoreOnSQLite@11ffbcb not RemitStoreOnSQLite!
- Build Failed AGP8
- Resume failed because of RESPONSE_PRECONDITION_FAILED
- Android13 taskEnd: 1 ERROR java.io.IOException: Create parent folder failed!
- How to Download with Referer on Header HOT 1
- m.My/ HOT 1
- targetSDK升级到30后无法正常使用 HOT 10
- 不需要断点续传的单文件下载场景,可使用以下替代方案试一试
- https://m.facebook.com,au
- 当前url请求失败或者下载异常,如何通过备用url或者ip直连的方式重试, HOT 2
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 okdownload.