首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >提取XZ压缩

提取XZ压缩
EN

Stack Overflow用户
提问于 2016-05-05 08:08:16
回答 1查看 1.2K关注 0票数 0

如何在java语言中提取XZ文件?I have a 7z SFX file with an .exe extensionconvert it into an XZ file,但我如何最终提取其内容?

在Windows上,我可以很容易地进行右键单击,然后从上下文菜单中选择Extract here,让WinRAR进行提取。

EN

回答 1

Stack Overflow用户

发布于 2016-05-05 08:12:15

试试这个

代码语言:javascript
复制
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); 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37040179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档