新增合并文件失败回调

pull/951/head
shawswyan 2 years ago
parent 619e007c7f
commit f396a40b5c
  1. 7
      PublicComponent/src/main/java/com/arialyy/aria/core/loader/NormalThreadStateManager.java

@ -19,6 +19,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.arialyy.aria.core.TaskRecord;
import com.arialyy.aria.core.inf.IThreadStateManager;
import com.arialyy.aria.core.listener.IEventListener;
@ -112,7 +113,7 @@ public class NormalThreadStateManager implements IThreadStateManager {
if (mergeFile()) {
mListener.onComplete();
} else {
mListener.onFail(false, null);
mListener.onFail(false, new AriaException("Merge File Failed"));
}
quitLooper();
break;
@ -253,8 +254,12 @@ public class NormalThreadStateManager implements IThreadStateManager {
* @return {@code true} 合并成功{@code false}合并失败
*/
private boolean mergeFile() {
Log.d(TAG, "mergeFile: mTaskRecord.threadNum=" + mTaskRecord.threadNum);
if (mTaskRecord.threadNum == 1) {
File targetFile = new File(mTaskRecord.filePath);
Log.d(TAG, "mergeFile: mTaskRecord.fileLength=" + mTaskRecord.fileLength
+ ",targetFile.length()=" + targetFile.length() + ",targetFile.exists()=" + targetFile.exists()
+ ",mTaskRecord.filePath" + mTaskRecord.filePath);
if (targetFile.exists()){
//没有获得文件长度:不支持断点续传
if (mTaskRecord.fileLength == 0 && targetFile.length() != 0) {

Loading…
Cancel
Save