我正在使用这种方法来压缩和解密文件: AesZipFileEncrypter.zipAndEncrypt
这段代码:
AesZipFileEncrypter.zipAndEncrypt(new File("C:\Test\Folder\MyFile.txt"), new File("C:\Test\Folder\MyZip.zip"), password, aesEncrypter);
还压缩我的文件的文件夹树,而不仅仅是文件。例如: 在创建的 zip 文件中添加 C:\Test\Folder\MyFile.txt 如果我想在根文件夹中只包含 MyFile.txt,我也会找到文件夹 C:\Test\Folder\MyFile.txt。 可能吗?
最佳答案
这是解决方案:
AESEncrypter aesEncrypter = new AESEncrypterBC();
aesEncrypter.init(password, 0);
AesZipFileEncrypter ze=new AesZipFileEncrypter(outputfilename, aesEncrypter);
ze.add(inputfilename,new FileInputStream(inputfilename), password);
ze.close();
关于java - AesZipFileEncrypter zipAndEncrypt 方法将所有文件夹树添加到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16399521/