如何在java语言中提取XZ文件?I have a 7z SFX file with an .exe extension、convert it into an XZ file,但我如何最终提取其内容?
在Windows上,我可以很容易地进行右键单击,然后从上下文菜单中选择Extract here,让WinRAR进行提取。
发布于 2016-05-05 08:12:15
试试这个
try {
FileInputStream fin = new FileInputStream(path + "myFile.xz");
BufferedInputStream in = new BufferedInputStream(fin);
FileOutputStream out = new FileOutputStream(des + "myDecompressed");
XZInputStream xzIn = new XZInputStream(in);
final byte[] buffer = new byte[8192];
int n = 0;
while (-1 != (n = xzIn.read(buffer))) {
out.write(buffer, 0, n);
}
out.close();
xzIn.close();
}
catch(Exception e) {
Log.e("Decompress", "unzip", e); https://stackoverflow.com/questions/37040179
复制相似问题