BufferedReader to BufferedWriter

Smith picture Smith · Aug 17, 2011 · Viewed 8.9k times · Source

How can I obtain a BufferedWriter from a BufferedReader?

I'd like to be able to do something like this:

BufferedReader read  = new BufferedReader(new InputStreamReader(...));
BufferedWriter write = new BufferedWriter(read);

Answer

Buhb picture Buhb · Aug 17, 2011

You can use the following from Apache commons io:

IOUtils.copy(reader, writer);

site here