Here you can find the source of copyStreamContent(InputStream inputStream, OutputStream outputStream)
public static int copyStreamContent(InputStream inputStream, OutputStream outputStream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static int copyStreamContent(InputStream inputStream, OutputStream outputStream) throws IOException { byte[] buffer = new byte[10240]; int total = 0; int count; while ((count = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, count); total += count;/*from w w w . ja v a 2 s.co m*/ } return total; } }