在 Java 中解码 Base64 数据

2022-01-21 00:00:00 base64 java

我有一张经过 Base64 编码的图像.在 Java 中解码的最佳方法是什么?希望只使用 Sun Java 6 附带的库.

I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6.

推荐答案

从 v6 开始,Java SE 附带 JAXB.javax.xml.bind.DatatypeConverter 有一些静态方法可以让这一切变得简单.请参阅 <代码>parseBase64Binary() 和 printBase64Binary().

As of v6, Java SE ships with JAXB. javax.xml.bind.DatatypeConverter has static methods that make this easy. See parseBase64Binary() and printBase64Binary().

相关文章