public class ParallelDownload
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_MAX_THREADS
默认最大线程数:10
|
static int |
DEFAULT_PART_BYTES
默认每块基准大小:30 Mb
|
| 构造器和说明 |
|---|
ParallelDownload(java.lang.String url,
int clientType,
HTTP http) |
| 限定符和类型 | 方法和说明 |
|---|---|
ParallelDownload |
maxThreads(int maxThreads)
指定分隔最大块数,即下载线程个数
|
ParallelDownload |
onlyGet()
指定服务器只支持 GET 请求
|
ParallelDownload |
partBytes(int partBytes)
指定每块下载大小(基准)
|
ParallelDownload |
setOnFailure(OnCallback<ParallelFailure> onFailure)
设置失败回调
|
ParallelDownload |
setOnProcess(OnCallback<ParallelProcess> onProcess)
设置下载进度回调
|
ParallelDownload |
setOnSuccess(OnCallback<java.io.File> onSuccess)
设置下载成功回调
|
void |
start()
开始下载
|
void |
start(long totalBytes)
开始下载
|
ParallelDownload |
toFile(java.io.File file) |
ParallelDownload |
toFile(java.lang.String filePath) |
public static final int DEFAULT_MAX_THREADS
public static final int DEFAULT_PART_BYTES
public ParallelDownload(java.lang.String url,
int clientType,
HTTP http)
public ParallelDownload partBytes(int partBytes)
partBytes - 分隔块数public ParallelDownload maxThreads(int maxThreads)
maxThreads - 分隔块数public ParallelDownload onlyGet()
public ParallelDownload toFile(java.lang.String filePath)
public ParallelDownload toFile(java.io.File file)
public ParallelDownload setOnSuccess(OnCallback<java.io.File> onSuccess)
onSuccess - 成功回调函数public ParallelDownload setOnProcess(OnCallback<ParallelProcess> onProcess)
onProcess - 进度回调public ParallelDownload setOnFailure(OnCallback<ParallelFailure> onFailure)
onFailure - 失败回调public void start()
public void start(long totalBytes)
totalBytes - 原文件大小Copyright © 2021 江苏一键联信息科技有限公司. All Rights Reserved.