Here you can find the source of writeStreamBuffered(final Reader in, final Writer out)
public static int writeStreamBuffered(final Reader in, final Writer out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.Reader; import java.io.Writer; public class Main { public static final int DEFAULT_BUFFER_SIZE = 8192; public static int writeStreamBuffered(final Reader in, final Writer out) throws IOException { return writeStreamBuffered(in, out, DEFAULT_BUFFER_SIZE); }/*from w ww . j a v a2 s.c o m*/ public static int writeStreamBuffered(final Reader in, final Writer out, final int bufferSize) throws IOException { final char[] cbuf = new char[bufferSize]; return writeStreamBuffered(in, out, cbuf); } public static int writeStreamBuffered(final Reader in, final Writer out, final char[] cbuf) throws IOException { int read; int count = 0; while (true) { read = in.read(cbuf); if (read == -1) { return count; } out.write(cbuf, 0, read); count += read; } } }