Reputation: 3421
What the java version of this python method?
http://docs.python.org/library/base64.html
base64.b64encode(s[, altchars]) Encode a string use Base64.
Optional altchars must be a string of at least length 2 (additional characters are ignored) which specifies an alternative alphabet for the + and / characters. This allows an application to e.g. generate URL or filesystem safe Base64 strings. The default is None, for which the standard Base64 alphabet is used.
..does java support altchars?
Upvotes: 2
Views: 1533
Reputation: 421040
Apache Commons, Base64
has a constructor (and various static methods) for URL safe Base64 encoding:
Base64(int lineLength, byte[] lineSeparator, boolean urlSafe)
urlSafe
- Instead of emitting '+
' and '/
' we emit '-
' and '_
' respectively.urlSafe
is only applied to encode operations. Decoding seamlessly handles both modes.
Upvotes: 1