com.openkm.servlet.frontend.FileUploadServlet
類中找到 importZip方法frontend
// Unzip files ArchiveDetector detector = new DefaultArchiveDetector(ArchiveDetector.ALL, new Object[]{"zip", new CheckedZip32Driver("GBK")}); File fileTmpIn = new File(tmpIn,detector); fileTmpIn.archiveCopyAllTo(tmpOut); File.umount();
增長紅色的部分spa
其實系統中使用的是TrueZIP,使用方法以下
解壓縮代碼以下:ip
ArchiveDetector detector = new DefaultArchiveDetector(ArchiveDetector.ALL,
new Object[] { "zip", new CheckedZip32Driver("GBK") } );
File zipFile = new File("zipFile", detector);
File dst = new File("dst");
// 解壓縮
zipFile.copyAllTo(dst);
代碼十分簡潔,注意這個File是servlet
de.schlichtherle.io.File