I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6.
Using Java 8 -
public static String encodeString(String plainString) { return Base64.getEncoder().encodeToString(plainString.getBytes()); } public static String decodeString(String encodedString) { byte[] bytes = Base64.getDecoder().decode(encodedString); return new String(bytes); }