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);