简体   繁体   English

如何使用Java创建不压缩的7z存档

[英]How to create 7z archive with no compression using java

now we are using library zip4j to create archive with no compression: 现在我们使用库zip4j来创建无压缩的存档:

ZipFile zipSoubor = new ZipFile("test.zip");

and when I want to stream I use: 当我要流式传输时,我使用:

zipSoubor.addStream(bis, getDefaultZipParameters());

and

private ZipParameters getDefaultZipParameters() {
    ZipParameters zipParametre = new ZipParameters();
    zipParametre.setCompressionMethod(Zip4jConstants.COMP_STORE);
    zipParametre.setSourceExternalStream(true);
    zipParametre.setEncryptFiles(true);
    zipParametre.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
    zipParametre.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
    zipParametre.setPassword(heslo);

    return zipParametre;
}

problem is when I open this archive in mc (F3) I see type is zip. 问题是当我在mc(F3)中打开此存档时,我看到类型是zip。 I need to create archive with type 7z. 我需要使用7z类型创建档案。 Is there some option how to create it in java ? 有一些选择如何在Java中创建它吗?

Apache Commons Compress( http://commons.apache.org/proper/commons-compress/ )添加了对编写7z文件的初步支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM