Closed
How to create and zip file and set the password
i used below code but no luck
try {
java.io.File CRCfile = new java.io.File("file://web:/StaticContent/global/ServiceExport/CRC.zip");
net.lingala.zip4j.core.ZipFile zipFile = new net.lingala.zip4j.core.ZipFile(CRCfile);
java.io.File fileToAdd = new java.io.File(FilePathName);
net.lingala.zip4j.model.ZipParameters parameters = new net.lingala.zip4j.model.ZipParameters();
parameters.setCompressionMethod(net.lingala.zip4j.util.Zip4jConstants.COMP_DEFLATE);
parameters.setCompressionLevel(net.lingala.zip4j.util.Zip4jConstants.DEFLATE_LEVEL_NORMAL);
parameters.setEncryptFiles(true);
parameters.setEncryptionMethod(net.lingala.zip4j.util.Zip4jConstants.ENC_METHOD_STANDARD);
parameters.setPassword("Test");
zipFile.addFile(fileToAdd,parameters);
} catch (net.lingala.zip4j.exception.ZipException e) {
e.printStackTrace();
}
***Edited by Moderator: Pallavi to update platform capability tags****