【问题标题】:Extracting XZ Compression提取 XZ 压缩
【发布时间】:2016-08-30 15:02:01
【问题描述】:

如何在 Java 中提取 XZ 文件? I have a 7z SFX file with an .exe extension, convert it into an XZ file 但我如何最终提取它的内容?

在 Windows 上,我可以轻松地单击鼠标右键,然后通过从上下文菜单中选择 Extract hereWinRAR 进行提取。

【问题讨论】:

    标签: java compression xz


    【解决方案1】:

    试试这个

    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字节。我不是为 Android 开发的
    猜你喜欢
    • 2015-07-25
    • 2015-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-17
    • 1970-01-01
    相关资源
    最近更新 更多