Forum Stats

  • 3,740,287 Users
  • 2,248,222 Discussions
  • 7,861,161 Comments

Discussions

Setting a Base64 alphabet

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.

Sign In or Register to comment.