Use zip4j library to unpack encrypted files, get results with first file empty
for(int i=0; i<password.length;i++){
ZipFile zip = new ZipFile(path);
if (zip.isEncrypted()) {
zip.setPassword(password[i]);
}
try{
zip.extractAll(neweachpath);
}
catch(ZipException e)
{if (e.getCode()==ZipExceptionConstants.WRONG_PASSWORD){
//System.out.println("wrong password");
}
}
}
I am using this piece of code to unpack a password file. The problem is there are many subfiles in the zip file, the first unpack is empty, the others are fine. If the zip file has one sub-file then the result is empty. Does anyone know how this happened? thank.
ps. iteration is just a way to check the password
+3
source to share
No one has answered this question yet
Check out similar questions: