Question

5
Replies
887
Views
Abhay Arun (AbhayA07)
Infosys

Infosys
IN
AbhayA07 Member since 2013 3 posts
Infosys
Posted: September 11, 2018
Last activity: September 12, 2018
Posted: 11 Sep 2018 5:36 EDT
Last activity: 12 Sep 2018 2:48 EDT
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 Experience
Moderation Team has archived post, This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.