/** * Adds the folder in the given path to the zip file. If zip file does not exist, * then a new zip file is created. If input folder path is invalid then an exception * is thrown. Zip parameters for the files in the folder to be added can be set in * the input parameters * @param path * @param parameters * @throws ZipException */ public void addFolder(String path, ZipParameters parameters) throws ZipException { if (!Zip4jUtil.isStringNotNullAndNotEmpty(path)) { throw new ZipException("input path is null or empty, cannot add folder to zip file"); } addFolder(new File(path), parameters); }
/** * Adds the folder in the given file object to the zip file. If zip file does not exist, * then a new zip file is created. If input folder is invalid then an exception * is thrown. Zip parameters for the files in the folder to be added can be set in * the input parameters * @param path * @param parameters * @throws ZipException */ public void addFolder(File path, ZipParameters parameters) throws ZipException { if (path == null) { throw new ZipException("input path is null, cannot add folder to zip file"); } if (parameters == null) { throw new ZipException("input parameters are null, cannot add folder to zip file"); } addFolder(path, parameters, true); }
/** * Adds the folder in the given file object to the zip file. If zip file does not exist, * then a new zip file is created. If input folder is invalid then an exception * is thrown. Zip parameters for the files in the folder to be added can be set in * the input parameters * @param path * @param parameters * @throws ZipException */ public void addFolder(NativeStorage path, ZipParameters parameters) throws ZipException { if (path == null) { throw new ZipException("input path is null, cannot add folder to zip file"); } if (parameters == null) { throw new ZipException("input parameters are null, cannot add folder to zip file"); } addFolder(path, parameters, true); }
public static void createAppPackageFile(File fileToBeCreated, File directory) throws ZipException { ZipFile zipFile = new ZipFile(fileToBeCreated); ZipParameters params = new ZipParameters(); params.setIncludeRootFolder(false); zipFile.addFolder(directory, params); }
private void generateZipFile() { try { File outputFile = new File(this.workFolder.getName() + ".zip"); if (outputFile.exists()) { Logger.info(outputFile.getAbsolutePath() + " already exists. Deleting."); outputFile.delete(); } ZipFile output = new net.lingala.zip4j.core.ZipFile(outputFile); Logger.info("Generating " + output.getFile().getAbsolutePath()); ZipParameters params = new ZipParameters(); params.setIncludeRootFolder(false); params.setRootFolderInZip(""); output.addFolder(this.workFolder.getAbsolutePath() + File.separator + "apktool", params); params.setRootFolderInZip("classes"); output.addFolder(this.workFolder.getAbsolutePath() + File.separator + "classes", params); } catch (Throwable t) { Logger.error("Unable to generate final zip file.", t); } }
for (Path path : Arrays.asList(configBackupPath, customBackupPath)) { if (Files.exists(path)) { zipFile.addFolder(path.toFile(), parameters);
zipFile.addFolder(srcFile, parameters); } else { zipFile.addFile(srcFile, parameters);
for (File directory : directories) getZipFile().addFolder(directory, parameters);
/** * Create a zip with the passed directory's contents in it. The directory will be the top entry * in the file if storeDirectory is true. * * @param zipFile * @param directory * @throws KlabException */ public static void zip(File zipFile, File directory, boolean storeDirectory, boolean readHiddenFiles) throws KlabException { // dest = buildDestinationZipFilePath(srcFile, dest); ZipParameters parameters = new ZipParameters(); // parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE); // // parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL); // parameters.setIncludeRootFolder(storeDirectory); // parameters.setReadHiddenFiles(readHiddenFiles); try { ZipFile zipF = new ZipFile(zipFile); zipF.addFolder(directory, parameters); } catch (ZipException e) { throw new KlabIOException(e); } }
zipFile.addFolder(srcFile, parameters); } else { zipFile.addFile(srcFile, parameters);
downloadOWAs(targetDirectory, distroProperties, owasDir); warfile.addFolder(tempDir, new ZipParameters()); try { FileUtils.deleteDirectory(tempDir);
this.zipModel.setSplitLength(splitLength); addFolder(folderToAdd, parameters, false);
this.zipModel.setSplitLength(splitLength); addFolder(folderToAdd, parameters, false);