简体   繁体   中英

How to create 7z archive with no compression using java

now we are using library zip4j to create archive with no compression:

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. I need to create archive with type 7z. Is there some option how to create it in java ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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