/** * * @param zipFile 压缩包文件 * @param descDir 解压缩文件存放路径 * @return */ public static boolean unzip(File zipFile, String descDir) { try (ZipArchiveInputStream inputStream = getZipFile(zipFile)) { File pathFile = new File(descDir); if (!pathFile.exists()) { pathFile.mkdirs(); } ZipArchiveEntry entry; while ((entry = inputStream.getNextZipEntry()) != null) { String name = entry.getName(); if (entry.isDirectory()) { File directory = new File(descDir, name); directory.mkdirs(); } else { OutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream(new File(descDir, name))); //输出文件路径信息 IOUtils.copy(inputStream, os); } finally { IOUtils.closeQuietly(os); } } } } catch (Exception e) { logger.error(\"[unzip] 解压zip文件出错\", e); return false; } return true; } private static ZipArchiveInputStream getZipFile(File zipFile) throws Exception { return new ZipArchiveInputStream(new BufferedInputStream(new FileInputStream(zipFile)),\"utf-8\", true); }