Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { private static int BUFFSIZE = 1024 * 8; public static void copyFileStream(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[BUFFSIZE]; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); } input.close(); output.close(); } }