question: public String generateDataURI ( final InputStream inputStream , final String fileName ) throws IOException { final StringWriter writer = new StringWriter ( ) ; final byte [ ] bytes = IOUtils . toByteArray ( inputStream ) ; inputStream . close ( ) ; final String mimeType = getMimeType ( fileName ) ; generateDataURI ( bytes , writer , mimeType ) ; return writer . toString ( ) ; }
target:  Generate the dataUri as string associated to the passed InputStream with encoding & type based on provided fileName.