Last updated 5 years ago
Was this helpful?
We no longer have to use sun.misc.BASE64Encoder or org.apache.commons.codec.binary.Base64. No we can use class. This is because the were encapsulated and are no longer available.
sun.misc.BASE64Encoder
org.apache.commons.codec.binary.Base64
byte[] toEncode = "dummy string".getBytes(); byte[] encoded = Base64.getEncoder().encode(toEncode); String encodedString = new String(encoded); Assert.assertEquals("ZHVtbXkgc3RyaW5n", encodedString);
Unsafe is meant to be used only by internal core Java classes.