1 package org.gffs.network;
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;
11 import org.gffs.io.IOUtils;
15 static final private int CONNECTION_TIMEOUT = 1000 * 8;
16 static final private int READ_TIMEOUT = 1000 * 8;
18 static public InputStream
connect(URL url)
throws IOException
20 URLConnection connection = url.openConnection();
21 connection.setConnectTimeout(CONNECTION_TIMEOUT);
22 connection.setReadTimeout(READ_TIMEOUT);
24 return connection.getInputStream();
27 static public void download(URL source, File target)
throws IOException
29 InputStream in =
null;
30 OutputStream out =
null;
34 out =
new FileOutputStream(target);
static void close(Closeable closeable)
static void copy(InputStream in, OutputStream out)
static InputStream connect(URL url)
static void download(URL source, File target)