Search in sources :

Example 6 with ZipFile

use of net.lingala.zip4j.core.ZipFile in project bamboobsc by billchen198318.

the class PdcaReportExcelCommand method createZipFile.

private String createZipFile(List<SysUploadVO> uploads) throws Exception {
    ZipFile zip = new ZipFile(Constants.getWorkTmpDir() + SimpleUtils.getUUIDStr() + ".zip");
    ZipParameters parameters = new ZipParameters();
    parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
    parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
    for (SysUploadVO reportUpload : uploads) {
        zip.addFile(UploadSupportUtils.getRealFile(reportUpload.getOid()), parameters);
    }
    return UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, zip.getFile(), "pdca-report.zip");
}
Also used : ZipFile(net.lingala.zip4j.core.ZipFile) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO) ZipParameters(net.lingala.zip4j.model.ZipParameters)

Example 7 with ZipFile

use of net.lingala.zip4j.core.ZipFile in project project-build-plugin by axonivy.

the class InstallEngineMojo method unpackEngine.

private void unpackEngine(File downloadZip) throws MojoExecutionException {
    try {
        String targetLocation = getRawEngineDirectory().getAbsolutePath();
        getLog().info("Unpacking engine " + downloadZip.getAbsolutePath() + " to " + targetLocation);
        ZipFile engineZip = new ZipFile(downloadZip);
        engineZip.extractAll(targetLocation);
    } catch (ZipException ex) {
        throw new MojoExecutionException("Failed to unpack downloaded engine '" + downloadZip + "'.", ex);
    }
}
Also used : ZipFile(net.lingala.zip4j.core.ZipFile) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ZipException(net.lingala.zip4j.exception.ZipException)

Example 8 with ZipFile

use of net.lingala.zip4j.core.ZipFile in project project-build-plugin by axonivy.

the class TestInstallEngineMojo method createFakeEngineZip.

private static File createFakeEngineZip(String ivyVersion) throws IOException, ZipException {
    File zipDir = createFakeEngineDir(ivyVersion);
    File zipFile = new File(zipDir, "fake.zip");
    ZipFile zip = new ZipFile(zipFile);
    zip.createZipFileFromFolder(new File(zipDir, OsgiDir.INSTALL_AREA), new ZipParameters(), false, 0);
    return zipFile;
}
Also used : ZipFile(net.lingala.zip4j.core.ZipFile) ZipFile(net.lingala.zip4j.core.ZipFile) File(java.io.File) ZipParameters(net.lingala.zip4j.model.ZipParameters)

Example 9 with ZipFile

use of net.lingala.zip4j.core.ZipFile in project leopard by tanhaichao.

the class ZipUtil method unzip.

/**
 * 解压zip格式压缩包
 */
public static void unzip(String sourceZip, String destDir) throws Exception {
    ZipFile zipFile = new ZipFile(sourceZip);
    zipFile.extractAll(destDir);
}
Also used : ZipFile(net.lingala.zip4j.core.ZipFile)

Example 10 with ZipFile

use of net.lingala.zip4j.core.ZipFile in project apex-core by apache.

the class StramTestSupport method createConfigPackageFile.

/**
   * Create an confPackage zip using the sample confPackage located in
   * src/test/resources/testConfPackage/testConfPackageSrc.
   *
   * @param file The file whose path will be used to create the confPackage zip
   * @return The File object that can be used in the ConfigPackage constructor.
   * @throws net.lingala.zip4j.exception.ZipException
   */
public static File createConfigPackageFile(File file) throws net.lingala.zip4j.exception.ZipException {
    ZipFile zipFile = new ZipFile(file);
    ZipParameters zipParameters = new ZipParameters();
    zipParameters.setIncludeRootFolder(false);
    zipFile.createZipFileFromFolder("src/test/resources/testConfigPackage/testConfigPackageSrc", zipParameters, false, Long.MAX_VALUE);
    return file;
}
Also used : ZipFile(net.lingala.zip4j.core.ZipFile) ZipParameters(net.lingala.zip4j.model.ZipParameters)

Aggregations

ZipFile (net.lingala.zip4j.core.ZipFile)17 ZipParameters (net.lingala.zip4j.model.ZipParameters)9 File (java.io.File)8 IOException (java.io.IOException)5 ZipException (net.lingala.zip4j.exception.ZipException)4 BinaryContent (ddf.catalog.data.BinaryContent)2 Result (ddf.catalog.data.Result)2 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)2 Instant (java.time.Instant)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)1 ConverterRuntimeException (com.odysseusinc.arachne.portal.exception.ConverterRuntimeException)1 StorageException (ddf.catalog.content.StorageException)1 StorageProvider (ddf.catalog.content.StorageProvider)1 ContentItem (ddf.catalog.content.data.ContentItem)1 DeleteStorageRequestImpl (ddf.catalog.content.operation.impl.DeleteStorageRequestImpl)1 DeletedMetacard (ddf.catalog.core.versioning.DeletedMetacard)1