Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { private static void copy(InputStream in, OutputStream out) throws IOException { byte[] b = new byte[1 * 1024]; int read; while ((read = in.read(b)) != -1) { out.write(b, 0, read); } } }