|
|
@ -80,13 +80,18 @@ final class HttpThreadTask extends AbsThreadTask<DownloadEntity, DownloadTaskEnt |
|
|
|
byte[] buffer = new byte[mBufSize]; |
|
|
|
byte[] buffer = new byte[mBufSize]; |
|
|
|
int len; |
|
|
|
int len; |
|
|
|
while ((len = is.read(buffer)) != -1) { |
|
|
|
while ((len = is.read(buffer)) != -1) { |
|
|
|
if (STATE.isCancel) break; |
|
|
|
if (STATE.isCancel || STATE.isStop){ |
|
|
|
if (STATE.isStop) break; |
|
|
|
break; |
|
|
|
if (mSleepTime > 0) Thread.sleep(mSleepTime); |
|
|
|
} |
|
|
|
|
|
|
|
if (mSleepTime > 0) { |
|
|
|
|
|
|
|
Thread.sleep(mSleepTime); |
|
|
|
|
|
|
|
} |
|
|
|
file.write(buffer, 0, len); |
|
|
|
file.write(buffer, 0, len); |
|
|
|
progress(len); |
|
|
|
progress(len); |
|
|
|
} |
|
|
|
} |
|
|
|
if (STATE.isCancel || STATE.isStop) return; |
|
|
|
if (STATE.isCancel || STATE.isStop){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
//支持断点的处理
|
|
|
|
//支持断点的处理
|
|
|
|
if (mConfig.SUPPORT_BP) { |
|
|
|
if (mConfig.SUPPORT_BP) { |
|
|
|
ALog.i(TAG, "任务【" + mConfig.TEMP_FILE.getName() + "】线程__" + mConfig.THREAD_ID + "__下载完毕"); |
|
|
|
ALog.i(TAG, "任务【" + mConfig.TEMP_FILE.getName() + "】线程__" + mConfig.THREAD_ID + "__下载完毕"); |
|
|
|