static void dataUri ( CssFormatter formatter , byte [ ] bytes , String urlStr , String type ) { if ( type == null ) { switch ( urlStr . substring ( urlStr . lastIndexOf ( ' ' ) + 1 ) ) { case "gif" : type = "image/gif;base64" ; break ; case "png" : type = "image/png;base64" ; break ; case "jpg" : case "jpeg" : type = "image/jpeg;base64" ; break ; default : type = "text/html" ; } } else { type = removeQuote ( type ) ; } if ( type . endsWith ( "base64" ) ) { formatter . append ( "url(\"data:" ) . append ( type ) . append ( ' ' ) ; formatter . append ( toBase64 ( bytes ) ) ; formatter . append ( "\")" ) ; } else { formatter . append ( "url(\"data:" ) . append ( type ) . append ( ' ' ) ; appendEncode ( formatter , bytes ) ; formatter . append ( "\")" ) ; } }
Write the bytes as inline url .