首先我们先来看一下效果图
要完成7z的压缩加密,我们首先先要下载7z工具,这个可以到官网自行下载,接下来我们只需将7z.dll,7z.exe,7z.sfx将这几个文件放在我们的工程目录,然后去引用即可。
关键代码示例:
private boolean zipByExternal(String zipFileName, String[] zipContentFileNameList, String compressionType, String password) throws Exception {
Runtime runtime = null;
Process process = null;
String command = "";
StringBuffer sbFilePath = null;
StringBuffer sbZipResult = null;
String zipLibPath = "";
String result = "";
InputStream inputStream = null;
int value = 0;
boolean isSuccess = false;
try{