From f2aa66e06f9600aec9189b0fc1c4803dc6f77c9e Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 31 Mar 2015 11:00:39 -0400 Subject: [PATCH] add a note about purpose here --- build/jre/src/Downloader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/jre/src/Downloader.java b/build/jre/src/Downloader.java index dd5bb5501..4b9ca870f 100644 --- a/build/jre/src/Downloader.java +++ b/build/jre/src/Downloader.java @@ -169,9 +169,11 @@ public class Downloader extends Task { InputStream input = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(input); File outputFile = new File(path); //folder, filename); + // Write to a temp file so that we don't have an incomplete download + // masquerading as a good archive. File tempFile = File.createTempFile("download", "", outputFile.getParentFile()); BufferedOutputStream output = - new BufferedOutputStream(new FileOutputStream(tempFile)); + new BufferedOutputStream(new FileOutputStream(tempFile)); int c = bis.read(); while (c != -1) { output.write(c);