嗨,我有将 base64 值解码为其原始值的代码。
public class Decode {
public static void main(String[] args) throws IOException {
String base64= "0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAGgAAAAAAAAAAEAAA/v///wAAAAD+////AAAAABkAAAD///"
byte[] bytes = Base64.decodeBase64(base64);
String testFileName = "tmp" +File.separator + "base64.xlsx";
FileOutputStream fos = new FileOutputStream(new File(testFileName));
IOUtils.write(bytes, fos);
}
}
base64 变量是 zip 文件的编码值。我能够将其解码回其原始格式,但无法打开 zip 文件。它显示文件无效。我错在哪里。?提前致谢。