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; /*/*from w ww . j av a2 s. c om*/ * @(#)AgentUtils.java 2015-7-27 ????05:26:24 * javaagent * Copyright 2015 Thuisoft, Inc. All rights reserved. * THUNISOFT PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ 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 = 0; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; } }