Hallo,
ich habe hier im Forum schon danach gesucht, leider ohne erfolg.
Google hat mir auch nix brauchbares ausgespuckt.
Hier mal der Code:
[JAVA=1]final URL url = new URL(D.DownloadURL);
final URLConnection conn = url.openConnection();
final InputStream is = new BufferedInputStream(conn.getInputStream());
final OutputStream os = new BufferedOutputStream(new FileOutputStream(D.DownloadTitel+".flv"));
byte[] chunk = new byte[1024];
int chunkSize;
int i=0;
while ((chunkSize = is.read(chunk)) != -1) {
os.write(chunk, 0, chunkSize);
i++;
System.out.println("Prozent berechnen???????");
}
os.flush(); // Necessary for Java < 6
os.close();
is.close();[/code]
Das Daownloaden von Dateien funktioniert einwandfrei, nur wie kann ich die Prozentzahl mit ausgeben lassen?
Ich bedanke mich schonmal im Voraus.
MfG
ich habe hier im Forum schon danach gesucht, leider ohne erfolg.
Google hat mir auch nix brauchbares ausgespuckt.
Hier mal der Code:
[JAVA=1]final URL url = new URL(D.DownloadURL);
final URLConnection conn = url.openConnection();
final InputStream is = new BufferedInputStream(conn.getInputStream());
final OutputStream os = new BufferedOutputStream(new FileOutputStream(D.DownloadTitel+".flv"));
byte[] chunk = new byte[1024];
int chunkSize;
int i=0;
while ((chunkSize = is.read(chunk)) != -1) {
os.write(chunk, 0, chunkSize);
i++;
System.out.println("Prozent berechnen???????");
}
os.flush(); // Necessary for Java < 6
os.close();
is.close();[/code]
Das Daownloaden von Dateien funktioniert einwandfrei, nur wie kann ich die Prozentzahl mit ausgeben lassen?
Ich bedanke mich schonmal im Voraus.
MfG