Java/Groovy 中的 Base64 编码 [英] Base64 encoding in Java / Groovy
本文介绍了Java/Groovy 中的 Base64 编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Java 中将字节 [] 转换为 Base64 字符串的正确方法是什么?更好的是 Grails/Groovy,因为它告诉我 encodeAsBase64()
函数已被弃用.不推荐使用 sun.misc.BASE64Encoder
包,它会在某些 Windows 平台上输出不同大小的字符串.
What is the proper way to convert a byte [] to a Base64 string in Java? Better yet would be Grails / Groovy because it tells me that the encodeAsBase64()
function is deprecated. The sun.misc.BASE64Encoder
package isn't recommended for use and outputs a different size string on some Windows platforms.
推荐答案
Apache Commons 有很多实用程序:
Apache Commons has many utilities:
二进制包:http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Base64.html
下载:http://commons.apache.org/codec/download_codec.cgi
这篇关于Java/Groovy 中的 Base64 编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文