How does one convert a file that has been base64 encoded back to its original format and write it to disk? For instance I have a pdf file which has been mime64 encoded. The file starts with:
data:application/pdf;base64,JVBER
I would like to write this out to disk in the proper format. I have tried several libraries (e.g. ring.util.codec) that decode the string into a byte-array, but if I write the resulting byte-array out to a file (using spit) the file appears corrupted.
UPDATE:
The PHP function base64_decode appears to be doing what I am looking for, as it returns a string. What is the equivalent in Java?