This commit is contained in:
Mathis Chenuet
2015-01-18 16:50:28 +01:00
committed by Laurent CLOUET
parent da5fbabb91
commit be687718c6
4 changed files with 13 additions and 13 deletions

View File

@@ -524,14 +524,14 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
FileOutputStream fos = new FileOutputStream(destination_);
byte[] ch = new byte[512 * 1024];
int nb;
long writed = 0;
long written = 0;
long last_gui_update = 0; // size in byte
while ((nb = inStrm.read(ch)) != -1) {
fos.write(ch, 0, nb);
writed += nb;
if ((writed - last_gui_update) > 1000000) { // only update the gui every 1MB
gui_.status(String.format(status_, (int) (100.0 * writed / size)));
last_gui_update = writed;
written += nb;
if ((written - last_gui_update) > 1000000) { // only update the gui every 1MB
gui_.status(String.format(status_, (int) (100.0 * written / size)));
last_gui_update = written;
}
}
fos.close();