private void generateDataURI ( final byte [ ] bytes , final Writer out , final String mimeType ) throws IOException { // create the output final StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( DATA_URI_PREFIX ) ; // add MIME type buffer . append ( mimeType ) ; // output base64-encoding buffer . append ( ";base64," ) ; buffer . append ( Base64 . encodeBytes ( bytes ) ) ; // output to writer out . write ( buffer . toString ( ) ) ; }
Generates a data URI from a byte array and outputs to the given writer .