Java tutorial
import java.io.IOException; import java.io.Reader; import java.io.Writer; public class Main { /** * Read input from reader and write it to writer until there is no more * input from reader. * * @param reader the reader to read from. * @param writer the writer to write to. * @param buf the char array to use as a bufferx */ public static void flow(Reader reader, Writer writer, char[] buf) throws IOException { int numRead; while ((numRead = reader.read(buf)) >= 0) { writer.write(buf, 0, numRead); } } }