src/main/java/org/edgegallery/appstore/infrastructure/util/AppUtil.java
public String compressCsarAppPackage(String intendedDir) {
        final Path srcDir = Paths.get(intendedDir);
        String zipFileName = intendedDir.concat(CSAR_EXTENSION);
        String[] fileName = zipFileName.split("/");
        String fileStorageAdd = srcDir + "/" + fileName[fileName.length - 1];
        try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName))) {
            createCompressedFile(out, new File(intendedDir), "");
        } catch (IOException e) {
            throw new AppException(ZIP_PACKAGE_ERR_MESSAGES, ResponseConst.RET_COMPRESS_FAILED);
        }
        try {
            FileUtils.deleteDirectory(new File(intendedDir));
            FileUtils.moveFileToDirectory(new File(zipFileName), new File(intendedDir), true);
        } catch (IOException e) {
            throw new AppException(ZIP_PACKAGE_ERR_MESSAGES, ResponseConst.RET_COMPRESS_FAILED);
        }
        return fileStorageAdd;
    }
/**
     * ZIP application package.
     *
     * @param intendedDir application package ID
     */
ZIP application package.
@param intendedDir application package ID
ZIP application package . @param intendedDir application package ID
public String compressCsarAppPackage(String intendedDir) {
        final Path srcDir = Paths.get(intendedDir);
        String zipFileName = intendedDir.concat(CSAR_EXTENSION);
        String[] fileName = zipFileName.split("/");
        String fileStorageAdd = srcDir + "/" + fileName[fileName.length - 1];
        try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName))) {
            createCompressedFile(out, new File(intendedDir), "");
        } catch (IOException e) {
            throw new AppException(ZIP_PACKAGE_ERR_MESSAGES, ResponseConst.RET_COMPRESS_FAILED);
        }
        try {
            FileUtils.deleteDirectory(new File(intendedDir));
            FileUtils.moveFileToDirectory(new File(zipFileName), new File(intendedDir), true);
        } catch (IOException e) {
            throw new AppException(ZIP_PACKAGE_ERR_MESSAGES, ResponseConst.RET_COMPRESS_FAILED);
        }
        return fileStorageAdd;
    }
public String compressCsarAppPackage ( String intendedDir ) { final Path srcDir = Paths . get ( intendedDir ) ; String zipFileName = intendedDir . concat ( CSAR_EXTENSION ) ; String [ ] fileName = zipFileName . split ( "/" ) ; String fileStorageAdd = srcDir + "/" + fileName [ fileName . length - 1 ] ; try ( ZipOutputStream out = new ZipOutputStream ( new FileOutputStream ( zipFileName ) ) ) { createCompressedFile ( out , new File ( intendedDir ) , "" ) ; } catch ( IOException e ) { throw new AppException ( ZIP_PACKAGE_ERR_MESSAGES , ResponseConst . RET_COMPRESS_FAILED ) ; } try { FileUtils . deleteDirectory ( new File ( intendedDir ) ) ; FileUtils . moveFileToDirectory ( new File ( zipFileName ) , new File ( intendedDir ) , true ) ; } catch ( IOException e ) { throw new AppException ( ZIP_PACKAGE_ERR_MESSAGES , ResponseConst . RET_COMPRESS_FAILED ) ; } return fileStorageAdd ; }
ZIP application package.
ZIP application package .