如何使用编码的docx?(解压缩)
问题描述:
HI 所以我的代码是这样的,我得到一个DOCX,并把解压缩文件的文件夹,如何使用编码的docx?(解压缩)
和方法解压是
private static void unzip(File zipfile, File directory) throws IOException {
ZipFile zfile = new ZipFile(zipfile);
Enumeration<? extends ZipEntry> entries = zfile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
File file = new File(directory, entry.getName());
if (entry.isDirectory()) {
file.mkdirs();
}
else {
file.getParentFile().mkdirs();
InputStream in = zfile.getInputStream(entry);
try {
copy(in, file);
}
finally {
in.close();
}
}
}
}
事情是,我需要使用在Base64 外部docx,但如何? 尝试这种
String wordx = "DocxInBase64";
byte[] dataFileWord = java.util.Base64.getDecoder().decode(wordx);
String dataw = new String(dataFileWord,StandardCharsets.UTF_8);
但即时得到的东西看起来像损坏
PKXsgl}'_ BR;曲@ 。〜HWX = 4pv {3o'M,bwiO0E] }` x ?...
任何想法开始? 在此先感谢