|
|
@ -23,13 +23,16 @@ import com.arialyy.aria.core.download.DTaskWrapper; |
|
|
|
import com.arialyy.aria.core.download.DownloadEntity; |
|
|
|
import com.arialyy.aria.core.download.DownloadEntity; |
|
|
|
import com.arialyy.aria.core.download.downloader.Downloader; |
|
|
|
import com.arialyy.aria.core.download.downloader.Downloader; |
|
|
|
import com.arialyy.aria.core.download.downloader.HttpFileInfoThread; |
|
|
|
import com.arialyy.aria.core.download.downloader.HttpFileInfoThread; |
|
|
|
|
|
|
|
import com.arialyy.aria.core.inf.AbsTaskWrapper; |
|
|
|
import com.arialyy.aria.core.scheduler.ISchedulers; |
|
|
|
import com.arialyy.aria.core.scheduler.ISchedulers; |
|
|
|
import com.arialyy.aria.exception.BaseException; |
|
|
|
import com.arialyy.aria.exception.BaseException; |
|
|
|
|
|
|
|
import com.arialyy.aria.util.ALog; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 子任务下载工具,负责创建{@link Downloader} |
|
|
|
* 子任务下载器,负责创建{@link Downloader} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class SubDownloadLoader implements IUtil { |
|
|
|
class SubDownloadLoader implements IUtil { |
|
|
|
|
|
|
|
private final String TAG = "SubDownloadLoader"; |
|
|
|
|
|
|
|
|
|
|
|
private Downloader mDownloader; |
|
|
|
private Downloader mDownloader; |
|
|
|
private DTaskWrapper mWrapper; |
|
|
|
private DTaskWrapper mWrapper; |
|
|
@ -88,6 +91,7 @@ class SubDownloadLoader implements IUtil { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override public void start() { |
|
|
|
@Override public void start() { |
|
|
|
|
|
|
|
if (mWrapper.getRequestType() == AbsTaskWrapper.D_HTTP) { |
|
|
|
new Thread(new HttpFileInfoThread(mWrapper, new OnFileInfoCallback() { |
|
|
|
new Thread(new HttpFileInfoThread(mWrapper, new OnFileInfoCallback() { |
|
|
|
|
|
|
|
|
|
|
|
@Override public void onComplete(String url, CompleteInfo info) { |
|
|
|
@Override public void onComplete(String url, CompleteInfo info) { |
|
|
@ -99,6 +103,12 @@ class SubDownloadLoader implements IUtil { |
|
|
|
mSchedulers.obtainMessage(ISchedulers.FAIL, SubDownloadLoader.this); |
|
|
|
mSchedulers.obtainMessage(ISchedulers.FAIL, SubDownloadLoader.this); |
|
|
|
} |
|
|
|
} |
|
|
|
})).start(); |
|
|
|
})).start(); |
|
|
|
|
|
|
|
} else if (mWrapper.getRequestType() == AbsTaskWrapper.D_FTP) { |
|
|
|
|
|
|
|
mDownloader = new Downloader(mListener, mWrapper); |
|
|
|
|
|
|
|
mDownloader.start(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ALog.w(TAG, String.format("不识别的类型,requestType:%s", mWrapper.getRequestType())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override public void resume() { |
|
|
|
@Override public void resume() { |
|
|
|