Here you can find the source of copyStream(Reader in, Writer out)
public static void copyStream(Reader in, Writer out) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void copyStream(Reader in, Writer out) throws IOException { char[] buffer = new char[2048]; int nread; int col = 0; try {//from ww w . j a v a 2 s .c om nread = in.read(buffer); while (nread > 0) { out.write(buffer, 0, nread); nread = in.read(buffer); System.out.print("."); if (col++ > 60) { System.out.println(); col = 0; } } } finally { System.out.println(); in.close(); out.close(); } } public static void copyStream(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[2048]; int nread; int col = 0; try { nread = in.read(buffer); while (nread > 0) { out.write(buffer, 0, nread); nread = in.read(buffer); System.out.print("."); if (col++ > 60) { System.out.println(); col = 0; } } } finally { System.out.println(); in.close(); out.close(); } } }