本文整理汇总了Java中org.wlf.filedownloader.DownloadFileInfo.getFilePath方法的典型用法代码示例。如果您正苦于以下问题:Java DownloadFileInfo.getFilePath方法的具体用法?Java DownloadFileInfo.getFilePath怎么用?Java DownloadFileInfo.getFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wlf.filedownloader.DownloadFileInfo
的用法示例。
在下文中一共展示了DownloadFileInfo.getFilePath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createByDownloadFile
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
public static FileDownloadTaskParam createByDownloadFile(DownloadFileInfo downloadFileInfo, String requestMethod,
Map<String, String> headers) {
if (downloadFileInfo == null) {
return null;
}
FileDownloadTaskParam fileDownloadTaskParam = new FileDownloadTaskParam(downloadFileInfo.getUrl(),
downloadFileInfo.getDownloadedSizeLong(), downloadFileInfo.getFileSizeLong(), downloadFileInfo
.getETag(), downloadFileInfo.getLastModified(), downloadFileInfo.getAcceptRangeType(),
downloadFileInfo.getTempFilePath(), downloadFileInfo.getFilePath());
fileDownloadTaskParam.mRequestMethod = requestMethod;
fileDownloadTaskParam.mHeaders = headers;
return fileDownloadTaskParam;
}
示例2: checkNewFileExist
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
/**
* check new file whether exist
*/
private boolean checkNewFileExist(File newFile) {
if (newFile != null && newFile.exists()) {// the file has been exist
return true;
}
List<DownloadFileInfo> downloadFileInfos = mDownloadFileRenamer.getDownloadFiles();
if (!CollectionUtil.isEmpty(downloadFileInfos)) {
for (DownloadFileInfo info : downloadFileInfos) {
if (info == null) {
continue;
}
String path = info.getFilePath();
if (TextUtils.isEmpty(path)) {
continue;
}
if (path.equals(newFile.getAbsolutePath())) {// the file has been exist
return true;
}
}
}
return false;
}
示例3: onFileDownloadStatusPreparing
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
@Override
public void onFileDownloadStatusPreparing(DownloadFileInfo downloadFileInfo) {
// 准备中(即,正在连接资源)
DownloadTask downloadTask = new DownloadTask(downloadFileInfo.getUrl().hashCode() , downloadFileInfo.getUrl() , downloadFileInfo.getFilePath() ,
downloadFileInfo.getFileSizeLong() , downloadFileInfo.getDownloadedSizeLong() , System.currentTimeMillis());
if(mDownloadChangedListener != null){
mDownloadChangedListener.update(downloadTask);
}
}
示例4: onFileDownloadStatusCompleted
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
@Override
public void onFileDownloadStatusCompleted(DownloadFileInfo downloadFileInfo) {
// 下载完成(整个文件已经全部下载完成)
DownloadTask downloadTask = new DownloadTask(downloadFileInfo.getUrl().hashCode() , downloadFileInfo.getUrl() , downloadFileInfo.getFilePath() ,
downloadFileInfo.getFileSizeLong() , downloadFileInfo.getDownloadedSizeLong() ,-1);
downloadTask.setFinish(true);
if(mDownloadChangedListener != null){
mDownloadChangedListener.update(downloadTask);
}
File file = new File(downloadFileInfo.getFilePath());
if(file != null && file.exists()){
file.delete();
}
}
示例5: onFileDownloadStatusFailed
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
@Override
public void onFileDownloadStatusFailed(String url, DownloadFileInfo downloadFileInfo, FileDownloadStatusFailReason failReason) {
// 下载失败了,详细查看失败原因failReason,有些失败原因你可能必须关心
DownloadTask downloadTask = new DownloadTask(downloadFileInfo.getUrl().hashCode() , downloadFileInfo.getUrl() , downloadFileInfo.getFilePath() ,
downloadFileInfo.getFileSizeLong() , downloadFileInfo.getDownloadedSizeLong() ,-1);
downloadTask.setFinish(true);
if(mDownloadChangedListener != null){
mDownloadChangedListener.update(downloadTask);
}
String failType = failReason.getType();
String failUrl = failReason.getUrl();// 或:failUrl = url,url和failReason.getUrl()会是一样的
if(FileDownloadStatusFailReason.TYPE_URL_ILLEGAL.equals(failType)){
// 下载failUrl时出现url错误
}else if(FileDownloadStatusFailReason.TYPE_STORAGE_SPACE_IS_FULL.equals(failType)){
// 下载failUrl时出现本地存储空间不足
}else if(FileDownloadStatusFailReason.TYPE_NETWORK_DENIED.equals(failType)){
// 下载failUrl时出现无法访问网络
}else if(FileDownloadStatusFailReason.TYPE_NETWORK_TIMEOUT.equals(failType)){
// 下载failUrl时出现连接超时
}else{
// 更多错误....
}
// 查看详细异常信息
Throwable failCause = failReason.getCause();// 或:failReason.getOriginalCause()
// 查看异常描述信息
String failMsg = failReason.getMessage();// 或:failReason.getOriginalCause().getMessage()
}
示例6: onDownloadFileUpdated
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
@Override
public void onDownloadFileUpdated(DownloadFileInfo downloadFileInfo, Type type) {
// 一个下载文件被更新,也许你需要同步你自己的数据存储,比如在你的业务数据库中更新一条记录
DownloadTask downloadTask = new DownloadTask(downloadFileInfo.getUrl().hashCode() , downloadFileInfo.getUrl() , downloadFileInfo.getFilePath() ,
downloadFileInfo.getFileSizeLong() , downloadFileInfo.getDownloadedSizeLong() ,-1);
if(mDownloadChangedListener != null){
mDownloadChangedListener.update(downloadTask);
}
}