我正在尝试从 Dropbox 中解码我的一个文件。使用本论坛中的一篇帖子
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.StringUtils;
String base64String = getFileResults.get_Response();//returns a file content in base64
String result = StringUtils.newStringUtf8(Base64.decodeBase64(base64String));
但是 Netbeans 一直告诉我,decodeBase64() 不接受字符串,但 API 说它接受 Base 64 的字符串。
我错过了什么?
最佳答案
尝试 Java SE 中提供的 javax.xml.bind.DatatypeConverter.parseBase64Binary(base64String)
。
关于java - 使用 Apache Commons 进行 base64 字符串解码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21494053/