Here you can find the source of writeStream(InputStream _from, Writer _printTo)
private static final void writeStream(InputStream _from, Writer _printTo) throws IOException
//package com.java2s; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.Writer; public class Main { private static final void writeStream(InputStream _from, Writer _printTo) throws IOException { final Reader in = new BufferedReader(new InputStreamReader(new BufferedInputStream(_from))); while (in.ready()) _printTo.write(in.read());//from w w w.j a v a2 s .c o m } }