如何创建base64二进制数据?
什么是 base64Binary 以及如何从 Java 中给定的字节数组创建 base64Binary?
What is base64Binary and how can I create base64Binary from a given byte array in Java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 commons-codec 与
公共静态字节[]encodeBase64(byte[]binaryData)
。Try commons-codec with
public static byte[] encodeBase64(byte[] binaryData)
.要创建此类数据,您可以使用 JDK 内置类 sun.misc。 BASE64编码器。不幸的是,它不是公共 API,因为没有人愿意在公共 API 中提供 BASE64 编码/解码器 - 但人们经常使用此类来规避这个缺点。
base64Binary 是一种 XML 模式数据类型,指的是任意二进制数据使用 BASE64 编码 进行编码,以检索该数据的“安全”字符串表示形式 - 例如在 XML、邮件等中嵌入二进制数据。
W3C 定义:
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: