Код: Выделить всё
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.util.Zip4jConstants;
public class UnunzipDemo{
public void unzipFilesWithPassword(String sourceZipFilePath,String extractedZipFilePath,String password){
try {
ZipFile zipFile = new ZipFile(sourceZipFilePath);
if (zipFile.isEncrypted()) {
zipFile.setPassword(password);
}
zipFile.extractAll(extractedZipFilePath);
System.out.println("Done");
}
catch (ZipException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String sourceZipFilePath="E:/MyFiles/Files/Zip/Demo.zip";
String extractedZipFilePath="E:/MyFiles/Files/Unzip/";
String password="JOEL"; //Correct Password
UnunzipDemo unzipDemo=new UnunzipDemo();
unzipDemo.unzipFilesWithPassword(sourceZipFilePath,extractedZipFilePath,password);
}
}Подробнее здесь: https://stackoverflow.com/questions/543 ... play-appro
Мобильная версия