goja-core/src/main/java/goja/core/kits/stream/StreamUtil.java
public static int copy(Reader input, Writer output) throws IOException {
        char[] buffer = new char[ioBufferSize];
        int count = 0;
        int read;
        while ((read = input.read(buffer, 0, ioBufferSize)) >= 0) {
            output.write(buffer, 0, read);
            count += read;
        }
        output.flush();
        return count;
    }
public static int copy(Reader input, Writer output) throws IOException {
        char[] buffer = new char[ioBufferSize];
        int count = 0;
        int read;
        while ((read = input.read(buffer, 0, ioBufferSize)) >= 0) {
            output.write(buffer, 0, read);
            count += read;
        }
        output.flush();
        return count;
    }
Copies reader to writer using buffer.
Streams don't have to be wrapped to buffered, since copying is already optimized.