Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,22 @@ private void downloadFileWithProgressBar(String url, Path target, HttpResponse<I
int count;

try (InputStream body = response.body();
FileOutputStream fileOutput = new FileOutputStream(target.toFile());
BufferedOutputStream bufferedOut = new BufferedOutputStream(fileOutput, data.length);
IdeProgressBar pb = this.context.newProgressBarForDownload(contentLength)) {
while (!fileComplete) {
count = body.read(data);
if (count <= 0) {
fileComplete = true;
} else {
bufferedOut.write(data, 0, count);
pb.stepBy(count);
try (FileOutputStream fileOutput = new FileOutputStream(target.toFile())) {
BufferedOutputStream bufferedOut = new BufferedOutputStream(fileOutput, data.length);
IdeProgressBar pb = this.context.newProgressBarForDownload(contentLength)) {
while (!fileComplete) {
count = body.read(data);
if (count <= 0) {
fileComplete = true;
} else {
bufferedOut.write(data, 0, count);
pb.stepBy(count);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

private void copyFileWithProgressBar(Path source, Path target) {
Expand Down
Loading