I have retrieved the base64 data uri from a html5 canvas. Within my servlet, I would like to decode the data uri and use it as an input stream as shown in \"xxx\" below. The
This needs almost the exact opposite to this answer! Or at least, the reverse of it. It answers Image
to base 64 String
, whereas this use-case is String
to Image
.
Look to javax.xml.bind.DatatypeConverter.parseBase64Binary(String) to get a byte[]
of the String
.
Use the byte[]
to construct a ByteArrayInputStream.