Here you can find the source of copyFile(InputStream in, OutputStream out)
public static void copyFile(InputStream in, OutputStream out) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void copyFile(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[10240]; int len;// ww w . j a va 2 s . c om while ((len = in.read(buffer)) >= 0) { out.write(buffer, 0, len); } } }