Fix download file
This commit is contained in:
parent
b816cb3199
commit
b3686c8417
1 changed files with 11 additions and 8 deletions
|
@ -313,15 +313,18 @@ public class DownloadFileHelper {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
targetFile.getParentFile().mkdirs();
|
targetFile.getParentFile().mkdirs();
|
||||||
FileOutputStream out = new FileOutputStream(targetFile);
|
FileOutputStream out = new FileOutputStream(targetFile);
|
||||||
int read;
|
try {
|
||||||
byte[] buffer = new byte[BUFFER_SIZE];
|
int read;
|
||||||
int remaining = length;
|
byte[] buffer = new byte[BUFFER_SIZE];
|
||||||
while ((read = toRead.read(buffer)) != -1) {
|
int remaining = length;
|
||||||
out.write(buffer, 0, read);
|
while ((read = toRead.read(buffer)) != -1) {
|
||||||
remaining -= countIS.getAndClearReadCount();
|
out.write(buffer, 0, read);
|
||||||
progress.remaining(remaining / 1024);
|
remaining -= countIS.getAndClearReadCount();
|
||||||
|
progress.remaining(remaining / 1024);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
}
|
}
|
||||||
out.close();
|
|
||||||
targetFile.setLastModified(de.dateModified);
|
targetFile.setLastModified(de.dateModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue