Here you can find the source of FileCopy(InputStream input, OutputStream output, int bufferSize)
public static void FileCopy(InputStream input, OutputStream output, int bufferSize) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void FileCopy(InputStream input, OutputStream output, int bufferSize) throws IOException { byte[] buf = new byte[bufferSize]; int n = input.read(buf); while (n >= 0) { output.write(buf, 0, n);/*w w w . j ava 2s . co m*/ n = input.read(buf); } output.flush(); } }