1 package org.splat.launcher;
3 import java.io.BufferedOutputStream;
4 import java.io.FileOutputStream;
5 import java.io.IOException;
6 import java.io.InputStream;
7 import java.io.OutputStream;
9 import java.net.URLConnection;
12 public class FileTransfer {
14 final static int size = 1024;
16 public static void Download (String path, String filename, String destination) {
17 // ------------------------------------------------------------------------------
18 URLConnection conx = null; // Communication link between the application and a URL.
19 InputStream is = null;
20 OutputStream os = null;
25 // int ByteWritten = 0;
28 os = new BufferedOutputStream( new FileOutputStream(destination + "/" + filename) );
29 // The URLConnection object is created by invoking the openConnection method on a URL.
31 conx = url.openConnection();
32 is = conx.getInputStream();
34 while ((ByteRead = is.read(buf)) != -1) {
35 os.write(buf, 0, ByteRead);
36 // ByteWritten += ByteRead;
38 // System.out.println("File \"" + filename + "\" successfully downloaded");
48 catch (IOException e) {