Here you can find the source of dump(InputStream inputStream, OutputStream out)
private static long dump(InputStream inputStream, OutputStream out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { private static long dump(InputStream inputStream, OutputStream out) throws IOException { long total = 0; int read; int bufferSize = 8192; byte[] buffer = new byte[bufferSize]; while ((read = inputStream.read(buffer, 0, bufferSize)) > -1) { out.write(buffer, 0, read);// w w w .jav a 2 s . c om total += read; } out.flush(); return total; } }