Here you can find the source of copyLarge(InputStream input, OutputStream output)
public static long copyLarge(InputStream input, OutputStream output) 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 long copyLarge(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[4096]; long count = 0L; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n);//from ww w.j a va2 s . c o m count += n; } return count; } }