Mercurial > hg > graal-compiler
diff mxtool/URLConnectionDownload.java @ 4188:148fa38782e8
Downloads are attempted via Java first since it shows a progress counter.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 03 Jan 2012 15:49:22 +0100 |
parents | 6c5f528c7aac |
children | 0b781cdb0cfb |
line wrap: on
line diff
--- a/mxtool/URLConnectionDownload.java Tue Jan 03 13:54:11 2012 +0100 +++ b/mxtool/URLConnectionDownload.java Tue Jan 03 15:49:22 2012 +0100 @@ -75,7 +75,7 @@ for (String s : urls) { try { - System.err.println("Downloading " + s + " to " + path + proxyMsg); + System.err.println("Downloading " + s + " to " + path + proxyMsg); URL url = new URL(s); URLConnection conn = url.openConnection(); // 10 second timeout to establish connection @@ -88,7 +88,8 @@ int n = 0; while ((read = in.read(buf)) != -1) { n += read; - System.err.print("\r " + n + " bytes " + (size == -1 ? "" : " ( " + (n * 100 / size) + "%)")); + long percent = ((long) n * 100 / size); + System.err.print("\r " + n + " bytes " + (size == -1 ? "" : " (" + percent + "%)")); out.write(buf, 0, read); } System.err.println();