use of net.lingala.zip4j.model.ZipParameters in project ARChon-Packager by bpear96.
the class Step3 method archiveDir.
private void archiveDir(String path) {
try {
// Initiate ZipFile object with the path/name of the zip file.
String zipname = g.getSelectedAppName();
ZipFile zipFile = new ZipFile(Environment.getExternalStorageDirectory() + "/ChromeAPKS/" + zipname + ".zip");
// Folder to add
String folderToAdd = path;
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
ZipParameters parameters = new ZipParameters();
// set compression method to store compression
parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
// Set the compression level
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
// Add folder to the zip file
zipFile.addFolder(folderToAdd, parameters);
ArrayList filesToAdd = new ArrayList();
filesToAdd.add(new File(path + "app_main.html"));
filesToAdd.add(new File(path + "icon.png"));
zipFile.addFiles(filesToAdd, parameters);
} catch (Exception e) {
e.printStackTrace();
}
}
use of net.lingala.zip4j.model.ZipParameters in project tdi-studio-se by Talend.
the class Zip method doZip2.
// zip4j impl
private void doZip2(final File source, final List<File> list) throws Exception {
ZipFile zipFile = new ZipFile(targetZip);
if ("UTF-8".equalsIgnoreCase(encoding)) {
encoding = "UTF8";
}
zipFile.setFileNameCharset(encoding);
ZipParameters params = new ZipParameters();
params.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
params.setCompressionLevel(compressLevel);
if (isEncrypted && !"".equals(password)) {
params.setEncryptFiles(true);
params.setEncryptionMethod(encryptionMethod);
if (Zip4jConstants.ENC_METHOD_AES == encryptionMethod) {
params.setAesKeyStrength(aesKeyStrength);
}
params.setPassword(password);
}
params.setDefaultFolderPath(source.getAbsoluteFile().getPath());
zipFile.addFiles((ArrayList) list, params);
}
use of net.lingala.zip4j.model.ZipParameters in project apex-core by apache.
the class AppPackage method createAppPackageFile.
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);
}
use of net.lingala.zip4j.model.ZipParameters 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");
}
use of net.lingala.zip4j.model.ZipParameters 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;
}
Aggregations