Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { private static void copyStream(InputStream is, OutputStream os) throws IOException { byte[] buf = new byte[1024]; int len = 0; while ((len = is.read(buf)) != -1) { os.write(buf, 0, len); } } }