如何创建base64二进制数据?

发布于 2024-11-29 09:06:04 字数 59 浏览 3 评论 0原文

什么是 base64Binary 以及如何从 Java 中给定的字节数组创建 base64Binary?

What is base64Binary and how can I create base64Binary from a given byte array in Java?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忆沫 2024-12-06 09:06:04

尝试 commons-codec公共静态字节[]encodeBase64(byte[]binaryData)

Try commons-codec with public static byte[] encodeBase64(byte[] binaryData).

牵强ㄟ 2024-12-06 09:06:04

要创建此类数据,您可以使用 JDK 内置类 sun.misc。 BASE64编码器。不幸的是,它不是公共 API,因为没有人愿意在公共 API 中提供 BASE64 编码/解码器 - 但人们经常使用此类来规避这个缺点。

base64Binary 是一种 XML 模式数据类型,指的是任意二进制数据使用 BASE64 编码 进行编码,以检索该数据的“安全”字符串表示形式 - 例如在 XML、邮件等中嵌入二进制数据。

W3C 定义:

base64Binary 表示 Base64 编码的任意二进制数据。 base64Binary 的“值空间”是二进制八位组的有限长度序列的集合。对于 base64Binary 数据,整个二进制流使用 [RFC 2045] 中的 Base64 字母表进行编码。

To create such data you may use the JDK built-in class sun.misc.BASE64Encoder. Unfortunately it's not public API since nobody cared to provide a BASE64 en-/decoder in the public API - but people often use this class to circumvent that disadvantage.

base64Binary is an XML Schema data type, referring to arbitrary binary data that is to be encoded using BASE64 encoding to retrieve a "safe" string representation of that data - e.g. for embedding binary data in XML, mails etc.

W3C Definition:

base64Binary represents Base64-encoded arbitrary binary data. The ·value space· of base64Binary is the set of finite-length sequences of binary octets. For base64Binary data the entire binary stream is encoded using the Base64 Alphabet in [RFC 2045].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文