public abstract class DownloadExecutor<T> extends Object
限定符和类型 | 字段和说明 |
---|---|
protected ArrayList<DownloadResource> |
mDownloadRes |
构造器和说明 |
---|
DownloadExecutor(String name) |
限定符和类型 | 方法和说明 |
---|---|
void |
add(DownloadResource resource)
添加下载任务
|
void |
close()
关闭所有下载
|
File |
getDownloadDir() |
protected abstract T |
getDownloadModel(DownloadResource resource)
DownloadResource转换为下载对象
|
ArrayList<DownloadResource> |
getDownloadResource() |
DownloadResource |
getDownloadResource(String key)
通过唯一识别符获取下载资源
|
protected abstract DownloadResource |
getDownloadResource(T t)
下载对象转换为DownloadResource
|
protected void |
init() |
void |
interruptAll()
中断所有下载
|
abstract DownloadNotification |
notification(Context context,
DownloadResource resource)
创建按一个状态栏通知
|
protected DownloadResource |
readResource(String filePath)
读取文件下载资源
|
void |
recoverAll()
恢复所有下载
|
void |
registerDownloadStatusListener(DownloadStatusListener downloadStatusListener)
注册下载状态监听
|
void |
remove(DownloadResource resource)
移除下载任务
|
void |
restart(DownloadResource resource)
重启下载
|
void |
resume(DownloadResource resource)
恢复下载
|
protected ArrayList<DownloadResource> |
scanResource(File scanDir)
扫描本地的下载任务资源
|
protected void |
setContext(Context context) |
protected void |
setDownloadDir(File directory) |
void |
setDownloadEvent(DownloadEvent downloadEvent) |
void |
setHttpSafe(boolean safe) |
protected void |
setPool(PoolManager.Pool pool) |
void |
start(DownloadResource resource)
开始下载
|
void |
stop(DownloadResource resource)
停止下载
|
void |
unregisterDownloadStatusListener(DownloadStatusListener downloadStatusListener)
移除下载状态监听
|
protected void |
writeResource(DownloadResource resource)
存除下载资源到本地
|
protected ArrayList<DownloadResource> mDownloadRes
public DownloadExecutor(String name)
public void setHttpSafe(boolean safe)
protected void setContext(Context context)
public File getDownloadDir()
protected void setDownloadDir(File directory)
protected void setPool(PoolManager.Pool pool)
protected void init()
public ArrayList<DownloadResource> getDownloadResource()
public void setDownloadEvent(DownloadEvent downloadEvent)
protected abstract DownloadResource getDownloadResource(T t)
t
- protected abstract T getDownloadModel(DownloadResource resource)
resource
- public abstract DownloadNotification notification(Context context, DownloadResource resource)
context
- resource
- protected ArrayList<DownloadResource> scanResource(File scanDir)
protected DownloadResource readResource(String filePath)
filePath
- protected void writeResource(DownloadResource resource)
resource
- public DownloadResource getDownloadResource(String key)
key
- public void start(DownloadResource resource)
resource
- public void stop(DownloadResource resource)
resource
- public void resume(DownloadResource resource)
resource
- public void restart(DownloadResource resource)
resource
- public void add(DownloadResource resource)
resource
- public void remove(DownloadResource resource)
resource
- public void recoverAll()
public void interruptAll()
public void close()
public void registerDownloadStatusListener(DownloadStatusListener downloadStatusListener)
public void unregisterDownloadStatusListener(DownloadStatusListener downloadStatusListener)