我有一个代码来解码一个字符串,如下所示:
public static void main(String[] args) throws IOException {
String base64="anybase64value"
byte[] bytes = Base64.decodeBase64(base64);
String tempDir = System.getProperty("java.io.tmpdir");
System.out.println(System.getProperty("java.io.tmpdir"));
String testFileName = "/tmp/" + "base64.xlsx";
FileOutputStream fos = new FileOutputStream(new File(testFileName));
IOUtils.write(bytes, fos);
System.out.println("Wrote " + bytes.length + " bytes to: " + testFileName);
}
但是当我运行它时会抛出一个错误:
The method write(byte[], OutputStream) in the type IOUtils is not applicable for the arguments (byte[], File)
The method close() is undefined for the type File