From 3a3667f214690233519fa890de7c3dd6ad92a621 Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Tue, 24 Oct 2017 22:04:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E9=87=8D=E5=90=AF=EF=BC=8C=E5=AF=BC=E8=87=B4=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=20https://github.?= =?UTF-8?q?com/AriaLyy/Aria/issues/145?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/arialyy/aria/core/common/AbsThreadTask.java | 4 +++- .../arialyy/aria/core/download/downloader/FtpThreadTask.java | 5 +++-- .../aria/core/download/downloader/HttpThreadTask.java | 4 ++-- .../com/arialyy/aria/core/upload/uploader/FtpThreadTask.java | 4 ++-- app/src/main/assets/aria_config.xml | 2 +- .../com/arialyy/simple/download/FtpDownloadActivity.java | 3 +-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java index 92c27fa1..41a0f10a 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java @@ -133,6 +133,7 @@ public abstract class AbsThreadTask 5000) { mLastSaveTime = System.currentTimeMillis(); new Thread(new Runnable() { @@ -223,7 +224,8 @@ public abstract class AbsThreadTask } @Override public void run() { + //当前子线程的下载位置 + mChildCurrentLocation = mConfig.START_LOCATION; FTPClient client = null; InputStream is = null; BufferedRandomAccessFile file = null; @@ -72,8 +74,7 @@ class FtpThreadTask extends AbsFtpThreadTask file.seek(mConfig.START_LOCATION); byte[] buffer = new byte[mBufSize]; int len; - //当前子线程的下载位置 - mChildCurrentLocation = mConfig.START_LOCATION; + while ((len = is.read(buffer)) != -1) { if (STATE.isCancel) break; if (STATE.isStop) break; diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java index 5b3597c3..dd85cb83 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java @@ -48,6 +48,8 @@ final class HttpThreadTask extends AbsThreadTask { } @Override public void run() { + //当前子线程的下载位置 + mChildCurrentLocation = mConfig.START_LOCATION; FTPClient client = null; BufferedRandomAccessFile file = null; try { @@ -56,8 +58,6 @@ class FtpThreadTask extends AbsFtpThreadTask { + ",结束位置:" + mConfig.END_LOCATION + "】"); - //当前子线程的下载位置 - mChildCurrentLocation = mConfig.START_LOCATION; client = createClient(); if (client == null) return; initPath(); diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index e88bed32..30e0dca9 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -5,7 +5,7 @@ - + diff --git a/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java b/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java index c68c2844..e7dd8d89 100644 --- a/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java @@ -35,9 +35,8 @@ import java.io.File; * Ftp下载测试 */ public class FtpDownloadActivity extends BaseActivity { - private final String URL = "ftp://d:d@dygodj8.com:12311/[电影天堂www.dy2018.com]光辉岁月BD韩语中字.rmvb"; //private final String URL = "ftp://192.168.1.9:21/下载/AriaPrj.zip"; - //private final String URL = "ftp://192.168.1.9:21/下载/[电影天堂www.dy2018.com]赛车总动员3BD中英双字.mp4"; + private final String URL = "ftp://192.168.1.9:21/下载/[电影天堂www.dy2018.com]赛车总动员3BD中英双字.mp4"; @Override protected void init(Bundle savedInstanceState) { super.init(savedInstanceState);