zip4j

Cannot unzip files created with Windows “Sent to compressed folder” in scala/java

拟墨画扇 提交于 2020-08-25 05:16:27
问题 I zipped a bunch of IIS log files on a windows 2008 r2 vm by selecting them in Windows Explorer and then using the Send To -> Compressed zipped folder. I wrote different programs in scala using java.util.ZipFile, zip4j and apache commons compress library. zip4j returns: Exception in thread "main" net.lingala.zip4j.exception.ZipException: Unknown compression method commons compress returns: org.apache.commons.compress.compressors.CompressorException: No Compressor found for the stream

部署异步下载服务

别说谁变了你拦得住时间么 提交于 2020-08-06 10:55:51
异步下载 一、背景 目前系统对于大文件的下载慢、导出慢、大量的接口占用服务器带宽等问题,严重影响用户的体验,基于此背景,开发并实现了异步下载功能。 二、项目结构 脑图思路 三、环境准备 maven依赖 <!-- zip加密 --> <dependency> <groupId>net.lingala.zip4j</groupId> <artifactId>zip4j</artifactId> <version>2.5.2</version> </dependency> <!-- 谷歌图片压缩 --> <dependency> <groupId>net.coobird</groupId> <artifactId>thumbnailator</artifactId> <version>0.4.11</version> </dependency> 四、具体实现 异步下载源码 /** * 异步下载:下载文件到新建文件夹中-->压缩文件夹-->删除文件夹 * * @author mc * @date 2020-05-18 17:50 **/ @ResponseBody @PostMapping("/asyDown") @ApiOperation(value = "异步下载", notes = "下载文件到新建文件夹中-->压缩文件夹-->删除文件夹") public Result<String

Exception when create zipFile in Android with Zip4j: Probably not a zip file or a corrupted zip file

蓝咒 提交于 2020-08-05 07:26:07
问题 I meet a problem when using zip4j library to generate zipfile in android, here's the code : try { ZipFile zipFile = new ZipFile(dest); zipFile.setFileNameCharset("GBK"); if (srcFile.isDirectory()) { zipFile.addFolder(srcFile, parameters); } else { zipFile.addFile(srcFile, parameters); } } catch (Exception e) { e.printStackTrace(); } and I got the Exception msg: net.lingala.zip4j.exception.ZipException: Probably not a zip file or a corrupted zip file at net.lingala.zip4j.core.HeaderReader

Exception when create zipFile in Android with Zip4j: Probably not a zip file or a corrupted zip file

你说的曾经没有我的故事 提交于 2020-08-05 07:25:10
问题 I meet a problem when using zip4j library to generate zipfile in android, here's the code : try { ZipFile zipFile = new ZipFile(dest); zipFile.setFileNameCharset("GBK"); if (srcFile.isDirectory()) { zipFile.addFolder(srcFile, parameters); } else { zipFile.addFile(srcFile, parameters); } } catch (Exception e) { e.printStackTrace(); } and I got the Exception msg: net.lingala.zip4j.exception.ZipException: Probably not a zip file or a corrupted zip file at net.lingala.zip4j.core.HeaderReader

zip4j, extract a password protected file from an inputstream (blob inputstream which is a zip file)

一笑奈何 提交于 2020-04-14 07:48:22
问题 I have a database that contains blobs and a password protected zip inside this database, using the standard File object approach i traditionally see File zipFile = new File("C:\\file.zip"); net.lingala.zip4j.core.ZipFile table = new net.lingala.zip4j.core.ZipFile(zipFile); if (table.isEncrypted()) table.setPassword(password); net.lingala.zip4j.model.FileHeader entry = table.getFileHeader("file_inside_the_zip.txt"); return table.getInputStream(entry); //Decrypted inputsteam! my question is,

Decompress .zip file with Java using zip4j

情到浓时终转凉″ 提交于 2019-12-23 03:12:51
问题 I'm trying to decompress a zip file with the API ZipFile from net.lingala.zip4j public static void unzip(File zipf, File baseDir) throws IOException, ZipException { String source = zipf.getAbsolutePath();//"some/compressed/file.zip"; String destination = baseDir.getPath();//"some/destination/folder"; // String password = "password"; try { ZipFile zipFile = new ZipFile(source); if (zipFile.isEncrypted()) { // zipFile.setPassword(password); } zipFile.extractAll(destination); } catch

How to add a file in a specific folder (in the ZIP)

我的未来我决定 提交于 2019-12-20 04:24:57
问题 The following code, how to add a file to a zip using java: String source = "C:/Users/XXXXX/Desktop/Helicopter.zip"; try { ZipFile zipFile = new ZipFile(source); ZipParameters parameters = new ZipParameters(); zipFile.addFile(new File("C:/Users/XXXXXX/Desktop/HELLO_HELICOPTER.txt"), parameters); } catch (net.lingala.zip4j.exception.ZipException e) { e.printStackTrace(); } How am I able to add the file in a specific folder in this zip-archive? 回答1: I found the solution: Put the file you want to

Zip4j Excluding Folders from Zip

无人久伴 提交于 2019-12-12 04:23:50
问题 I have a directory with some folders that should be skipped and not added to the target ZIP file. I marked them as hidden on Windows and I can query this attribute using Java code as follows: new File("C:\\myHiddenFolder").isHidden(); However, I don't know how to use this with the following Zip4j-based method to skip adding those respective directories: public File createZipArchive(String sourceFilePath) throws ZipException, IOException { ZipParameters zipParameters = new ZipParameters();

zip4j Compression type not supported Exception: Android

倖福魔咒の 提交于 2019-12-12 02:37:24
问题 I am trying to unzip a password protected zip file using zip4j library for android. But it is giving Unsupported Compression Type exception. I have searched a lot but could not find any reason or solution for it. So my questions are: Why i am getting this exception? How to solve this problem? Should i use any other library? try { File src = new File("/sdcard/" + filename); ZipFile zipFile = new ZipFile(src); if (zipFile.isEncrypted()) { zipFile.setPassword("mypassword"); } File destFile=new