use of net.lingala.zip4j.core.ZipFile in project tdi-studio-se by Talend.
the class Unzip method doUnzipWithAes.
// zip4j compress&decryption impl
public void doUnzipWithAes() throws Exception {
File file = new File(sourceZip);
if (password == null || "".equals(password)) {
// To make sure the System.out.println message
Thread.sleep(1000);
// come before
throw new RuntimeException("Please enter the password and try again..");
}
ZipFile zipFile = new ZipFile(sourceZip);
if (checkArchive) {
if (!zipFile.isValidZipFile()) {
throw new RuntimeException("The file " + sourceZip + " is corrupted, process terminated...");
}
}
if (zipFile.isEncrypted()) {
zipFile.setPassword(password);
}
List fileHeaderList = zipFile.getFileHeaders();
if (fileHeaderList == null) {
return;
}
for (int i = 0; i < fileHeaderList.size(); i++) {
FileHeader fileHeader = (FileHeader) fileHeaderList.get(i);
String filename = fileHeader.getFileName();
if (verbose) {
System.out.println("Source file : " + filename);
}
if (!extractPath) {
filename = filename.replaceAll("\\\\", "/");
filename = filename.substring(filename.lastIndexOf('/') + 1);
}
zipFile.extractFile(fileHeader, targetDir, null, filename);
}
}
use of net.lingala.zip4j.core.ZipFile in project bamboobsc by billchen198318.
the class JReportUtils method selfTestDecompress4Upload.
public static String selfTestDecompress4Upload(String uploadOid) throws ServiceException, IOException, Exception {
String extractDir = Constants.getWorkTmpDir() + "/" + JReportUtils.class.getSimpleName() + "/" + SimpleUtils.getUUIDStr() + "/";
File realFile = UploadSupportUtils.getRealFile(uploadOid);
try {
ZipFile zipFile = new ZipFile(realFile);
zipFile.extractAll(extractDir);
} catch (Exception e) {
throw e;
} finally {
realFile = null;
}
return extractDir;
}
use of net.lingala.zip4j.core.ZipFile in project bamboobsc by billchen198318.
the class BusinessProcessManagementUtils method decompressResource.
public static File[] decompressResource(File resourceZipFile) throws Exception {
String extractDir = Constants.getWorkTmpDir() + "/" + BusinessProcessManagementUtils.class.getSimpleName() + "/" + SimpleUtils.getUUIDStr() + "/";
ZipFile zipFile = new ZipFile(resourceZipFile);
zipFile.extractAll(extractDir);
File dir = new File(extractDir);
return dir.listFiles();
}
use of net.lingala.zip4j.core.ZipFile in project sonarlint-core by SonarSource.
the class SonarlintInstaller method installZip.
private void installZip(Path zipFilePath, Path toDir) {
try {
ZipFile zipFile = new ZipFile(zipFilePath.toFile());
zipFile.extractAll(toDir.toString());
} catch (Exception e) {
throw new IllegalStateException("Fail to unzip SonarLint Daemon to" + toDir, e);
}
}
use of net.lingala.zip4j.core.ZipFile in project grakn by graknlabs.
the class DistributionContext method unzipDistribution.
private void unzipDistribution() throws ZipException {
// Unzip the distribution
ZipFile zipped = new ZipFile(ZIP_FULLPATH.toFile());
zipped.extractAll(TARGET_DIRECTORY.toAbsolutePath().toString());
}
Aggregations