|
|
@ -105,16 +105,16 @@ public class NormalThreadStateManager implements IThreadStateManager { |
|
|
|
// mergerSFtp();
|
|
|
|
// mergerSFtp();
|
|
|
|
// mListener.onComplete();
|
|
|
|
// mListener.onComplete();
|
|
|
|
//} else
|
|
|
|
//} else
|
|
|
|
|
|
|
|
if (mTaskRecord.isBlock || mTaskRecord.threadNum == 1) { |
|
|
|
if (mTaskRecord.isBlock) { |
|
|
|
|
|
|
|
if (mergeFile()) { |
|
|
|
if (mergeFile()) { |
|
|
|
mListener.onComplete(); |
|
|
|
mListener.onComplete(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mListener.onFail(false, null); |
|
|
|
mListener.onFail(false, null); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
quitLooper(); |
|
|
|
mListener.onComplete(); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
mListener.onComplete(); |
|
|
|
quitLooper(); |
|
|
|
quitLooper(); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -248,8 +248,13 @@ public class NormalThreadStateManager implements IThreadStateManager { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean mergeFile() { |
|
|
|
private boolean mergeFile() { |
|
|
|
if (mTaskRecord.threadNum == 1) { |
|
|
|
if (mTaskRecord.threadNum == 1) { |
|
|
|
|
|
|
|
File targetFile = new File(mTaskRecord.filePath); |
|
|
|
|
|
|
|
if (targetFile.exists() && targetFile.length() == mTaskRecord.fileLength){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
FileUtil.deleteFile(targetFile); |
|
|
|
File partFile = new File(String.format(IRecordHandler.SUB_PATH, mTaskRecord.filePath, 0)); |
|
|
|
File partFile = new File(String.format(IRecordHandler.SUB_PATH, mTaskRecord.filePath, 0)); |
|
|
|
return partFile.renameTo(new File(mTaskRecord.filePath)); |
|
|
|
return partFile.renameTo(targetFile); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<String> partPath = new ArrayList<>(); |
|
|
|
List<String> partPath = new ArrayList<>(); |
|
|
|