Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any RFC 2397 Data URI Parser for Java?

   dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
   mediatype  := [ type "/" subtype ] *( ";" parameter )
   data       := *urlchar
   parameter  := attribute "=" value

   value := token / quoted-string

According to these BNF from the RFCs, the comma that separates the data from the mime type can actually appear in both the mime type and the data, so there's no simple way (i.e. reg ex) to break the URI into parts. Thus a full parser is needed.

I am wondering does any one know any data URI libraries in Java? My Google search didn't yield anything.

like image 435
billc.cn Avatar asked Sep 10 '12 14:09

billc.cn


1 Answers

There is a Java data URI parser implementation available on GitHub called jDataUri.

Disclaimer: I am the author

like image 165
ooxi Avatar answered Oct 15 '22 19:10

ooxi