Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { private final static int BUFFER_SIZE = 0x400; public static void copyStream(InputStream is, OutputStream os) throws IOException { byte[] bytes = new byte[BUFFER_SIZE]; for (;;) { int count = is.read(bytes, 0, BUFFER_SIZE); if (count == -1) break; os.write(bytes, 0, count); } } }