|
|
@ -15,6 +15,8 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.arialyy.aria.core.download.downloader; |
|
|
|
package com.arialyy.aria.core.download.downloader; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.os.Handler; |
|
|
|
|
|
|
|
import android.os.Message; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.util.Log; |
|
|
|
import android.util.Log; |
|
|
|
import com.arialyy.aria.util.BufferedRandomAccessFile; |
|
|
|
import com.arialyy.aria.util.BufferedRandomAccessFile; |
|
|
@ -100,7 +102,7 @@ class FtpThreadTask extends AbsThreadTask { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (STATE.isCancel || STATE.isStop) return; |
|
|
|
if (STATE.isCancel || STATE.isStop) return; |
|
|
|
if (client.completePendingCommand()) { |
|
|
|
//if (client.completePendingCommand()) {
|
|
|
|
Log.i(TAG, "任务【" + mConfig.TEMP_FILE.getName() + "】线程__" + mConfig.THREAD_ID + "__下载完毕"); |
|
|
|
Log.i(TAG, "任务【" + mConfig.TEMP_FILE.getName() + "】线程__" + mConfig.THREAD_ID + "__下载完毕"); |
|
|
|
writeConfig(true, 1); |
|
|
|
writeConfig(true, 1); |
|
|
|
STATE.COMPLETE_THREAD_NUM++; |
|
|
|
STATE.COMPLETE_THREAD_NUM++; |
|
|
@ -112,16 +114,18 @@ class FtpThreadTask extends AbsThreadTask { |
|
|
|
STATE.isDownloading = false; |
|
|
|
STATE.isDownloading = false; |
|
|
|
mListener.onComplete(); |
|
|
|
mListener.onComplete(); |
|
|
|
} |
|
|
|
} |
|
|
|
file.close(); |
|
|
|
|
|
|
|
is.close(); |
|
|
|
|
|
|
|
Log.d(TAG, "SUCCESS"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
failDownload(mChildCurrentLocation, "下载失败【" + mConfig.DOWNLOAD_URL + "】", e); |
|
|
|
failDownload(mChildCurrentLocation, "下载失败【" + mConfig.DOWNLOAD_URL + "】", e); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
failDownload(mChildCurrentLocation, "获取流失败", e); |
|
|
|
failDownload(mChildCurrentLocation, "获取流失败", e); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
if (file != null){ |
|
|
|
|
|
|
|
file.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (is != null){ |
|
|
|
|
|
|
|
is.close(); |
|
|
|
|
|
|
|
} |
|
|
|
if (client != null && client.isConnected()) { |
|
|
|
if (client != null && client.isConnected()) { |
|
|
|
//client.logout();
|
|
|
|
//client.logout();
|
|
|
|
client.disconnect(); |
|
|
|
client.disconnect(); |
|
|
|