This question with regard to JDK 5 says, there is no implementation provided with JDK 5, but JDK 6 is supposed to have a sun.misc.Base64Decoder
.
As far
There are official (non sun.misc
) implementations in Java, but it's not where anyone suppose to be.
java.util.prefs.AbstractPreferences
is the one that has the necessary methods to do so. You have to override put
method.
And one more which is much easier to use:
javax.xml.bind.DatatypeConverter it has 2 methods of interest:
clarification the base64 nature of AbstractPreferences: java.util.prefs.Preferences
/** * Associates a string representing the specified byte array with the * specified key in this preference node. The associated string is * the Base64 encoding of the byte array, as defined in RFC 2045, Section 6.8, * with one minor change: the string will consist solely of characters * from the Base64 Alphabet; it will not contain any newline * characters. Note that the maximum length of the byte array is limited * to three quarters of MAX_VALUE_LENGTH so that the length * of the Base64 encoded String does not exceed MAX_VALUE_LENGTH. * This method is intended for use in conjunction with * {@link #getByteArray}. */ public abstract void putByteArray(String key, byte[] value);