本文整理汇总了Java中com.liulishuo.filedownloader.FileDownloadQueueSet类的典型用法代码示例。如果您正苦于以下问题:Java FileDownloadQueueSet类的具体用法?Java FileDownloadQueueSet怎么用?Java FileDownloadQueueSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileDownloadQueueSet类属于com.liulishuo.filedownloader包,在下文中一共展示了FileDownloadQueueSet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onClickMultiParallel
import com.liulishuo.filedownloader.FileDownloadQueueSet; //导入依赖的package包/类
/**
* Start multiple download tasks parallel
* <p>
* 启动并行多任务下载
*
* @param view
*/
public void onClickMultiParallel(final View view) {
updateDisplay(getString(R.string.hybrid_test_start_multiple_tasks_parallel, Constant.URLS.length));
// 以相同的listener作为target,将不同的下载任务绑定起来
final FileDownloadListener parallelTarget = createListener();
final List<BaseDownloadTask> taskList = new ArrayList<>();
int i = 0;
for (String url : Constant.URLS) {
taskList.add(FileDownloader.getImpl().create(url)
.setTag(++i));
}
totalCounts += taskList.size();
new FileDownloadQueueSet(parallelTarget)
.setCallbackProgressTimes(1)
.downloadTogether(taskList)
.start();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:HybridTestActivity.java
示例2: onClickMultiSerial
import com.liulishuo.filedownloader.FileDownloadQueueSet; //导入依赖的package包/类
/**
* Start multiple download tasks serial
* <p>
* 启动串行多任务下载
*
* @param view
*/
public void onClickMultiSerial(final View view) {
updateDisplay(getString(R.string.hybrid_test_start_multiple_tasks_serial, Constant.URLS.length));
// 以相同的listener作为target,将不同的下载任务绑定起来
final List<BaseDownloadTask> taskList = new ArrayList<>();
final FileDownloadListener serialTarget = createListener();
int i = 0;
for (String url : Constant.URLS) {
taskList.add(FileDownloader.getImpl().create(url)
.setTag(++i));
}
totalCounts += taskList.size();
new FileDownloadQueueSet(serialTarget)
.setCallbackProgressTimes(1)
.downloadSequentially(taskList)
.start();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:HybridTestActivity.java
示例3: downloads
import com.liulishuo.filedownloader.FileDownloadQueueSet; //导入依赖的package包/类
/**
* 批量任务下载
*/
public static void downloads(FDownListener listener, List<FTask> tasks) {
final FileDownloadQueueSet queueSet = new FileDownloadQueueSet(listener);
final List<BaseDownloadTask> baseDownloadTasks = new ArrayList<>();
for (FTask task : tasks) {
baseDownloadTasks.add(FileDownloader
.getImpl()
.create(task.url)
.setPath(task.path)
.setTag(task.url));
}
/**不回调进度*/
queueSet.disableCallbackProgressTimes(); // do not want each task's download progress's callback,
// we just consider which task will completed.
// auto retry 1 time if download fail
/**自动重试*/
queueSet.setAutoRetryTimes(1);
// start download in serial order
/**串行下载*/
//queueSet.downloadSequentially(baseDownloadTasks);
// if your baseDownloadTasks are not a list, invoke such following will more readable:
// queueSet.downloadSequentially(
// FileDownloader.getImpl().create(url).setPath(...),
// FileDownloader.getImpl().create(url).addHeader(...,...),
// FileDownloader.getImpl().create(url).setPath(...)
// );
// start parallel download
/**并行下载*/
queueSet.downloadTogether(baseDownloadTasks);
// if your baseDownloadTasks are not a list, invoke such following will more readable:
// queueSet.downloadTogether(
// FileDownloader.getImpl().create(url).setPath(...),
// FileDownloader.getImpl().create(url).setPath(...),
// FileDownloader.getImpl().create(url).setSyncCallback(true)
// );
queueSet.start();
}
开发者ID:angcyo,项目名称:RLibrary,代码行数:44,代码来源:FDown.java
注:本文中的com.liulishuo.filedownloader.FileDownloadQueueSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论