Is there a straight forward way to decode a base64 string using ONLY THE JAVA 1.5 LIBRARIES?
I have to use Java 1.5 due to cross platform compatibility issues between Windows and Mac OS X (only Mac 10.5 supports Java 1.6, everything lower than 10.5 has Java 1.5 as default).
The object “sun.misc.Base64Decoder” exists in Java 6, but not in Java 5.
No, it’s not possible based on just using JDK 5.0.
You’ll need to roll your own implementation (it isn’t that hard) or preferably use one of the open source implementations. There are lots including Commons Codec which provides Base64 http://commons.apache.org/codec/api-release/org/apache/commons/codec/binary/Base64.html
JavaMail also provides Base64 encoding/decoding via MimeUtility which also does quoted printable encoding etc…
http://java.sun.com/products/javamail/javadocs/javax/mail/internet/MimeUtility.html