Question

5
Replies
682
Views
AbhayA07 Member since 2013 3 posts
Infosys
Posted: 2 years ago
Last activity: 2 years 1 month ago
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****
Low-Code App Development Data Integration User Interface
Moderation Team has archived post
Share this page LinkedIn