Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting a Base64 alphabet

User_RZL54Dec 31 2020

I can do:
String encoded = Base64.getEncoder().withoutPadding().encodeToString(someByteArray);
so why can't I also do something like:
static final String PWD_B64ALPHABET = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
String encoded = Base64.getEncoder().withAlphabet(PWD_B64ALPHABET).encodeToString(someByteArray);
(and similarly with Base64.Decoder)
Given just how many variations of "base64" encoding there are out there, this would seem super useful.

Comments
Post Details
Added on Dec 31 2020
0 comments
202 views