| | |
| | | * @return zip文件保存绝对路径 |
| | | */ |
| | | public static long createZip(List<Map<String, String>> pathList, OutputStream os) { |
| | | log.info("正在打包文件..."); |
| | | try { |
| | | long size = 0; |
| | | ZipOutputStream out = new ZipOutputStream(os); |
| | |
| | | fileName = head + "(" + showCount + ")." + tail; |
| | | } |
| | | fileNameCountMap.put(fileName, ++showCount); |
| | | log.info(String.format("正在打包文件 %s", fileName)); |
| | | |
| | | //以论文标题为每个文件命名 |
| | | FileInputStream fis = new FileInputStream(downloadPath); |
| | |
| | | while ((len = fis.read(buffer)) > 0) { |
| | | if (symbol == 1) { |
| | | // 加密 |
| | | log.info("正在加密..."); |
| | | out.write(encryption(buffer), 0, len); |
| | | } else if (symbol == -1) { |
| | | // 解密 |
| | | log.info("正在解密..."); |
| | | out.write(decryption(buffer), 0, len); |
| | | } else { |
| | | // 单纯的复制 |