添加可以在线控制的下载源

This commit is contained in:
南宫临风
2016-06-28 20:48:27 +08:00
parent 9ae010a391
commit 94b6cda86e
17 changed files with 454 additions and 198 deletions

View File

@@ -118,7 +118,7 @@ public class FileDownloadTask extends Task implements PreviousResult<File>, Prev
this.url = IOUtils.parseURL(p.getResult());
for (int repeat = 0; repeat < 6; repeat++) {
if (repeat > 0)
if (repeat > 0) {
if (failedCallbackReturnsNewURL != null) {
URL tmp = IOUtils.parseURL(failedCallbackReturnsNewURL.apply(repeat));
if (tmp != null) {
@@ -126,6 +126,8 @@ public class FileDownloadTask extends Task implements PreviousResult<File>, Prev
HMCLog.warn("Switch to: " + url);
}
}
}
HMCLog.log("Downloading: " + url + ", to: " + filePath);
if (!shouldContinue)
break;
@@ -260,4 +262,8 @@ public class FileDownloadTask extends Task implements PreviousResult<File>, Prev
al.add(pr);
return this;
}
public void setFailedCallbackReturnsNewURL() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}