修复单线程下载时,文件已经完成,重复下载回调下载失败的问题

修复一个重新下载文件时,同名路径文件没有被被删除的问题
This commit is contained in:
laoyuyu
2020-11-12 22:35:14 +08:00
parent 840facd1cc
commit d7d081ffb1
9 changed files with 31 additions and 17 deletions

View File

@@ -35,10 +35,13 @@ final class HttpDTTBuilderAdapter extends AbsNormalTTBuilderAdapter {
BufferedRandomAccessFile file = null;
try {
if (totalThreadNum > 1 && !record.isBlock) {
file = new BufferedRandomAccessFile(new File(getTempFile().getPath()), "rwd", 8192);
file = new BufferedRandomAccessFile(getTempFile().getPath(), "rwd", 8192);
//设置文件长度
file.setLength(getEntity().getFileSize());
}
if (getTempFile().exists()) {
FileUtil.deleteFile(getTempFile());
}
return true;
} catch (IOException e) {
e.printStackTrace();