Questions tagged [zip4j]

A java open-source library to handle Zip files.

A library to work with .zip files. It has the following features

  • Create, Add, Extract, Update, Remove files from a Zip file
  • Read/Write password protected Zip files
  • Supports AES 128/256 Encryption
  • Supports Standard Zip Encryption
  • Supports Zip64 format
  • Supports Store (No Compression) and Deflate compression method
  • Create or extract files from Split Zip files (Ex: z01, z02,...zip)
  • Supports Unicode file names
  • Progress Monitor

The project home page: http://www.lingala.net/zip4j/

126 questions
2
votes
1 answer

Zip4J, Null Pointer Exception caused by external file stream?

I am trying to zip a bunch of files from different locations into one zip folder using Zip4J. I have an ArrayList of files from different folders, and as I loop through the list calling "zip.AddFile(file, params)" the files are added fine until the…
nsmith95
  • 51
  • 7
2
votes
0 answers

Compress folder in java

I'm developing a project in Eclipse with java 7 and I want compress a directory that it have many directories and files inside it and establish a password protected, i use for them zip4j library and it resolves my problem but not all because it only…
2
votes
1 answer

zip4j ZipFile getInputStream always returns byte array with size 1

The following code always results to a byte array with size 1, any ideas ? FileHeader fh = (FileHeader) packageFile.getFileHeaders().get(1); InputStream inputStream = packageFile.getInputStream(fh); byte[] bytes=new…
Grigor Nazaryan
  • 567
  • 5
  • 18
2
votes
4 answers

zip4j setFileNameCharset not working

I'm using zip4j to unzip files and i have a problem with file name charset . This is my code, try { ZipFile zipFile = new ZipFile(source); if (zipFile.isEncrypted()) { zipFile.setPassword(password); } …
jmt
  • 223
  • 1
  • 8
  • 28
2
votes
1 answer

get inputStream from zipFile then add to another zipFile getting null pointer exception

I'm trying to get input stream from zip file then add it to another zip file but it throws null pointer exception. here is my code. ZipParameters parameters = new ZipParameters(); ZipFile newZipFile = new ZipFile(new File(CacheDir,…
2
votes
1 answer

Password protected zip file not the file inside the zip

I want to create password protected ZIP: // Set the compression level parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL); // Set the encryption flag to true // If this is set to false, then the rest of encryption properties are…
Victo
  • 61
  • 1
  • 5
1
vote
2 answers

Creating password protected zip file using zip4j - the password is on the files level but not on zip file level

I'm trying to create password protected zip fileby the following code: ZipParameters zipParameters = new ZipParameters(); zipParameters.setEncryptFiles(true); zipParameters.setEncryptionMethod(EncryptionMethod.AES); List
shimiA
  • 233
  • 3
  • 8
1
vote
0 answers

What is the best way of getting files from AWS S3, inserting them into zip and uploading that zip to the bucket?

I'm trying to find efficient way of downloading files from s3, insert them into zip file, and after inserting those files into archive, upload it to the bucket. It should be efficient as archive could reach almost 10Gb.I tried to use one thread with…
1
vote
1 answer

using zip4j library version 1.3.2

I want to get the name of the list of files contained in a .zip file with password using zip4j library version 1.3.2. package com.gpcoder.compress; import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.exception.ZipException; public…
1
vote
0 answers

Zip4J - extract all items in folder straight to destination without "buffer" folder?

I am extracting a zip file in Java with Zip4j. The zip will look something like this: ZipName.zip | ->foo/ | ->SomeDirectory/ ->fooBar.dll I write ZipFile zipFile = new…
EP1997
  • 31
  • 1
  • 4
1
vote
2 answers

zib4j zipfile throws ZipException for zip file size less than minimum when adding files or folders

I try to add a folder to a zip file but I always get a ZipException that the zip file is less than the expected size. val file = File.createTempFile("export_", ".zip") val zipfile = ZipFile(file) val tmpFolder = context.cacheDir.absolutePath +…
GenError
  • 885
  • 9
  • 25
1
vote
1 answer

Folder Encryption Not Working (Demo Included)

This simple folder encryption/compression fails. The folder only contains a child folder and text file, yet encryption returns false. Any idea why? import net.lingala.zip4j.ZipFile; import net.lingala.zip4j.exception.ZipException; import…
Mathomatic
  • 899
  • 1
  • 13
  • 38
1
vote
2 answers

The method extractAll(String) is undefined for the type ZipFile with zip4j

I'm trying to make a program which unzips then parses the xml file in xml.zip. Adding the dependency for zip4j, this is my pom.xml
Amamra
  • 89
  • 1
  • 9
1
vote
1 answer

How to parse file inside a zip without writing to disk - java

I have a password protected zip file [in the form of a base64 encoded data and the name of the zip file] which contains a single xml. I wish to parse that xml without writing anything to disk. What is the way to do this in Zip4j? Following is what I…
gsdk
  • 57
  • 2
  • 8
1
vote
1 answer

How to hide file names with password inside zip password protected archive using zip4j

I wanna zip files with password protected archive. I have such imp: public class ZipArchiverAdapter implements ZipArchiverPort { private static final Logger log = LoggerFactory.getLogger(ZipArchiverAdapter.class); @Override public…
masterdany88
  • 5,041
  • 11
  • 58
  • 132
1
2
3
8 9