public class TemporaryRecord
extends java.lang.Object
| 构造器和说明 |
|---|
TemporaryRecord(DownloadBean bean) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
cancel() |
void |
complete() |
<any> |
download()
Normal download request.
|
void |
error() |
java.io.File |
file() |
boolean |
fileComplete() |
boolean |
fileNotComplete() |
void |
finish() |
long |
getContentLength() |
java.io.File[] |
getFiles() |
int |
getMaxRetryCount() |
int |
getMaxThreads() |
java.lang.String |
getSaveName() |
void |
init(int maxThreads,
int maxRetryCount,
java.lang.String defaultSavePath,
DownloadApi downloadApi,
DataBaseHelper dataBaseHelper)
init needs info
|
boolean |
isFileChanged() |
boolean |
isSupportRange() |
java.io.File |
lastModifyFile() |
void |
prepareNormalDownload()
prepare normal download, create files and save last-modify.
|
void |
prepareRangeDownload()
prepare range download, create necessary files and save last-modify.
|
<any> |
rangeDownload(int index)
Range download request
|
DownloadRange |
readDownloadRange(int index)
Read download range from record file.
|
java.lang.String |
readLastModify() |
void |
save(<any> e,
<any> response)
Normal download save.
|
void |
save(<any> emitter,
int index,
ResponseBody response)
Range download save
|
void |
setContentLength(long contentLength) |
void |
setFileChanged(boolean serverFileChanged) |
void |
setLastModify(java.lang.String lastModify) |
void |
setRangeSupport(boolean rangeSupport) |
void |
setSaveName(java.lang.String saveName) |
void |
start() |
java.io.File |
tempFile() |
boolean |
tempFileDamaged() |
void |
update(DownloadStatus status) |
public TemporaryRecord(DownloadBean bean)
public void init(int maxThreads,
int maxRetryCount,
java.lang.String defaultSavePath,
DownloadApi downloadApi,
DataBaseHelper dataBaseHelper)
maxThreads - Max download threadsmaxRetryCount - Max retry timesdefaultSavePath - Default save path;downloadApi - APIdataBaseHelper - DataBaseHelperpublic void prepareNormalDownload()
throws java.io.IOException,
java.text.ParseException
java.io.IOExceptionjava.text.ParseExceptionpublic void prepareRangeDownload()
throws java.io.IOException,
java.text.ParseException
java.io.IOExceptionjava.text.ParseExceptionpublic DownloadRange readDownloadRange(int index) throws java.io.IOException
index - indexjava.io.IOExceptionpublic void save(<any> e,
<any> response)
e - emitterresponse - responsepublic void save(<any> emitter,
int index,
ResponseBody response)
throws java.io.IOException
emitter - emitterindex - download indexresponse - responsejava.io.IOExceptionpublic <any> download()
public <any> rangeDownload(int index)
index - download indexpublic int getMaxRetryCount()
public int getMaxThreads()
public boolean isSupportRange()
public void setRangeSupport(boolean rangeSupport)
public boolean isFileChanged()
public void setFileChanged(boolean serverFileChanged)
public long getContentLength()
public void setContentLength(long contentLength)
public void setLastModify(java.lang.String lastModify)
public java.lang.String getSaveName()
public void setSaveName(java.lang.String saveName)
public java.io.File file()
public java.io.File tempFile()
public java.io.File lastModifyFile()
public boolean fileComplete()
public boolean tempFileDamaged()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readLastModify()
throws java.io.IOException
java.io.IOExceptionpublic boolean fileNotComplete()
throws java.io.IOException
java.io.IOExceptionpublic java.io.File[] getFiles()
public void start()
public void update(DownloadStatus status)
public void error()
public void complete()
public void cancel()
public void finish()