java - Creating password protected ZIP file using TrueZip -


does know example creating password protected zip file using truezip?

i followed the example given truezip example while extracting password protected zip file not accepting correct password set through java code.

i found solution this

try {         final tconfig config = tconfig.get();          // request encryption in archive files.         config.setoutputpreferences(config.getoutputpreferences()                 .or(bitfield.of(fsoutputoption.encrypt)));          // configure archive detector custom key management zip files.         config.setarchivedetector(newarchivedetector1("zip", "password"));          // setup file paths.         tfile src = new tfile("file1");         tfile dst = new tfile("file2");         if (dst.isarchive() || dst.isdirectory())             dst = new tfile(dst, src.getname());          // recursive copy.         src.cp_rp(dst);     } {         // commit changes.         tvfs.umount();     } 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -