gpt4 book ai didi

java - java中的base64encode altchars

转载 作者:太空宇宙 更新时间:2023-11-03 19:18:25 24 4
gpt4 key购买 nike

这个 python 方法的 java 版本是什么?

http://docs.python.org/library/base64.html

base64.b64encode(s[, altchars])使用 Base64 对字符串进行编码。

可选替代字符必须是长度至少为 2 的字符串(忽略其他字符),它指定 + 和/字符的替代字母表。这允许应用程序例如生成 URL 或文件系统安全的 Base64 字符串。默认值为 None,使用标准 Base64 字母表。

..java支持altchars吗?

最佳答案

Apache Commons,Base64 有一个用于 URL 安全 Base64 编码的构造函数(和各种静态方法):

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.

关于java - java中的base64encode altchars,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10588485/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com