Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void copy(InputStream inputstream, OutputStream outputstream) throws IOException { byte abyte0[] = new byte[50000]; do { int i = inputstream.read(abyte0); if (i > 0) { outputstream.write(abyte0, 0, i); } else { outputstream.close(); return; } } while (true); } }