aliocrlib/src/main/java/com/lib/aliocr/utils/io/IOUtils.java
/**
     * Get the contents of a <code>Reader</code> as a <code>byte[]</code>
     * using the specified character encoding.
     * <p/>
     * This method buffers the input internally, so there is no need to use a
     * <code>BufferedReader</code>.
     *
     * @param input    the <code>Reader</code> to read from
     * @param encoding the encoding to use, null means platform default
     * @return the requested byte array
     * @throws NullPointerException if the input is null
     * @throws IOException          if an I/O error occurs
     * @since 2.3
     */
Get the contents of a Reader as a byte[]
using the specified character encoding.

This method buffers the input internally, so there is no need to use a
BufferedReader.


Get the contents of a Reader as a byte [] using the specified character encoding . This method buffers the input internally so there is no need to use a BufferedReader .
public static byte[] toByteArray(Reader input, Charset encoding) throws IOException {
       ByteArrayOutputStream output = new  ByteArrayOutputStream();
        copy(input, output, encoding);
        return output.toByteArray();
    }
public static byte [ ] toByteArray ( Reader input , Charset encoding ) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; copy ( input , output , encoding ) ; return output . toByteArray ( ) ; }
Get the contents of a <code>Reader</code> as a <code>byte[]</code>
 using the specified character encoding.
Get the contents of a <code > Reader< / code > as a <code > byte [] < / code > using the specified character encoding .