public static void copy(Reader input, OutputStream output, Charset encoding) throws IOException {
        OutputStreamWriter out = new OutputStreamWriter(output, Charsets.toCharset(encoding));
        copy(input, out);
        // XXX Unless anyone is planning on rewriting OutputStreamWriter,
        // we have to flush here.
        out.flush();
    }
Copy chars from a <code>Reader</code> to bytes on an
<code>OutputStream</code> using the specified character encoding, and
calling flush.
<p>
This method buffers the input internally, so there is no need to use a
<code>BufferedReader</code>.
</p>
<p>
Due to the implementation of OutputStreamWriter, this method performs a
flush.
</p>
<p>
This method uses {@link OutputStreamWriter}.
</p>

@param input    the <code>Reader</code> to read from
@param output   the <code>OutputStream</code> to write to
@param encoding the encoding to use, null means platform default
@throws NullPointerException if the input or output is null
@throws IOException          if an I/O error occurs
@since 2.3
pay-java-common/src/main/java/com/egzosn/pay/common/util/IOUtils.java