Here you can find the source of copyStreams(InputStream in, OutputStream out)
public static void copyStreams(InputStream in, OutputStream out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void copyStreams(InputStream in, OutputStream out) throws IOException { byte[] b = new byte[8192]; int r;/* w w w . j a v a 2s . c om*/ while ((r = in.read(b)) >= 0) out.write(b, 0, r); } }