【发布时间】:2018-04-02 09:37:08
【问题描述】:
问题
我需要帮助来解码 base 64 字符串并使用 groovy 将其保存到本地目录中的 pdf/doc 这个脚本应该在 SOAP UI 中工作 base64 字符串长度为 52854 个字符
我已经尝试了以下
File f = new File("c:\\document1.doc")
FileOutputStream out = null
byte[] b1 = Base64.decodeBase64(base64doccontent);
out = new FileOutputStream(f)
try {
out.write(b1)
} finally {
out.close()
}
但是 - 它给了我以下错误
没有方法签名:静态 org.apache.commons.codec.binary.Base64.decodeBase64() 适用于参数类型:(java.lang.String) 值:[base64stringlong] 可能的解决方案:decodeBase64([B) , encodeBase64([B), encodeBase64([B, boolean)
【问题讨论】:
-
如果
base64doccontent是字符串,请尝试:base64doccontent.decodeBase64()。 docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/…