}
}//TODO 检测一下重命名的情况
}
//使用临时文件,以实现断点续传
EverboxDownloadInfo dInfo = EverboxContext.getDownloadInfo(ebo.getPath());
File tmpFile = null;
boolean append = false;
if(dInfo != null && ebo.getVer().equals(dInfo.getVer())) {
log.debug("查询到之前的下载信息,该文件之前下载过,尝试找回原本的临时文件");
tmpFile = new File(dInfo.getTempFilePath());
if(tmpFile.exists()){
log.debugf("已经下载过%d个字节",tmpFile.length());
append = true;
}
}
if(tmpFile == null || (!tmpFile.exists())){
log.debug("创建临时文件");
tmpFile = File.createTempFile("everbox4j_download", null);
dInfo = new EverboxDownloadInfo();
dInfo.setPath(ebo.getPath());
dInfo.setTempFilePath(tmpFile.getAbsolutePath());
dInfo.setVer(ebo.getVer());
}
EverboxContext.saveDownloadInfo(dInfo);
HttpGet httpGet = new HttpGet(thumbnailInfo.getString("dataurl"));
String str = Config.getUserAgent();
httpGet.setHeader("User-Agent", str);