Question

5
Replies
827
Views
Close popover
Abhay Arun (AbhayA07)
Infosys

Infosys
IN
AbhayA07 Member since 2013 3 posts
Infosys
Posted: September 11, 2018
Last activity: September 12, 2018
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,
Close popover 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.