@@ -52,6 +52,10 @@ public DownloadableContributionsDownloader(File _stagingFolder) {
52
52
}
53
53
54
54
public File download (DownloadableContribution contribution , Progress progress , final String statusText , ProgressListener progressListener ) throws Exception {
55
+ return download (contribution , progress , statusText , progressListener , false );
56
+ }
57
+
58
+ public File download (DownloadableContribution contribution , Progress progress , final String statusText , ProgressListener progressListener , boolean noResume ) throws Exception {
55
59
URL url = new URL (contribution .getUrl ());
56
60
Path outputFile = Paths .get (stagingFolder .getAbsolutePath (), contribution .getArchiveFileName ());
57
61
@@ -66,7 +70,7 @@ public File download(DownloadableContribution contribution, Progress progress, f
66
70
while (true ) {
67
71
// Need to download or resume downloading?
68
72
if (!Files .isRegularFile (outputFile , LinkOption .NOFOLLOW_LINKS ) || (Files .size (outputFile ) < contribution .getSize ())) {
69
- download (url , outputFile .toFile (), progress , statusText , progressListener );
73
+ download (url , outputFile .toFile (), progress , statusText , progressListener , noResume );
70
74
downloaded = true ;
71
75
}
72
76
@@ -113,6 +117,10 @@ private boolean hasChecksum(DownloadableContribution contribution) {
113
117
}
114
118
115
119
public void download (URL url , File tmpFile , Progress progress , String statusText , ProgressListener progressListener ) throws Exception {
120
+ download (url , tmpFile , progress , statusText , progressListener , false );
121
+ }
122
+
123
+ public void download (URL url , File tmpFile , Progress progress , String statusText , ProgressListener progressListener , boolean noResume ) throws Exception {
116
124
FileDownloader downloader = new FileDownloader (url , tmpFile );
117
125
downloader .addObserver ((o , arg ) -> {
118
126
FileDownloader me = (FileDownloader ) o ;
@@ -126,7 +134,7 @@ public void download(URL url, File tmpFile, Progress progress, String statusText
126
134
progress .setProgress (me .getProgress ());
127
135
progressListener .onProgress (progress );
128
136
});
129
- downloader .download ();
137
+ downloader .download (noResume );
130
138
if (!downloader .isCompleted ()) {
131
139
throw new Exception (format (tr ("Error downloading {0}" ), url ), downloader .getError ());
132
140
}
0 commit comments