7Z???????????

??

7-ZIP???????????????????? Aspose.Zip API?????????????????????????????????????7-ZIP???????????????????�Aspose.Zip API? SevenZiparchive?????????7-ZIP????????????�?????????????????????????????????????�API? SevenZiparchiveEntry?????????7Z????????????????????

7-zip???????????

????????Sevenziparchive???????????7-zip???????????????????

1try(fileoutputStream sevenzipfile = new fileoutputStream( "archive.7z")){
2    try(sevenziparchive archive = new SevenZiparchive()){
3        archive.createentry( "data.bin"??? "file.dat");
4        archive.save(sevenzipfile);
5    }
6} catch(ioException ex){
7}

7-zip????????????

SevenZiparchive?????????????????????????????????????????????Createentries???????????�?????????7-ZIP????????????????????????

1try(sevenziparchive archive = new SevenZiparchive()){
2    archive.createentries( "datadir");
3    archive.save( "sevenzip.7z");
4}

7-zip?????

Asopse.Zip API?? SevenzipaeSencryptionsettings7Z??????AES???????????????????????????????????AES????????????????????

1try(sevenziparchive archive = new SevenZiparchive(???SevenZipentrySettings(null?new Sevenzipaesencryptionsettings( "p@s $"))){
2    archive.createentry( "data.bin"???new bytearrayinputStream(new byte [] {0x00?(byte)0xff}));
3    archive.save( "archive.7z");
4}

AES-256??7Z????????????????????

LZMA??????7-ZIP?????

?????????LZMA???AES???????7Z????????????????????

 1try(fileoutputStream sevenzipfile = new fileoutputStream( "archive.7z")){
 2    try(sevenziparchive archive = new SevenZiparchive()){
 3        archive.createentry( "entry1.bin"?
 4                new bytearrayinputStream(new byte [] {0x00?(byte)0xff})?
 5                ???sevenzipentrysettings(???sevenziplzmacompressionsettings()?
 6                        ???sevenzipaesencryptionsettings( "test1"))?
 7                ???????( "data1.bin"));
 8        archive.save(sevenzipfile);
 9    }
10} catch(ioException ex){
11}

????BZIP2?PPMD?LZMA2????7Z????????????????????????????????

????????????????

??????????????????????????????????????????????????????????

 1try(fileoutputStream sevenzipfile = new fileoutputStream( "archive.7z")){
 2    ????fi1 = new file( "data1.bin");
 3    ????fi2 = new file( "data2.bin");
 4    ????fi3 = new file( "data3.bin");
 5
 6    try (SevenZipArchive archive = new SevenZipArchive()) {
 7        archive.createEntry("entry1.bin", fi1, false,
 8                new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(),
 9                        new SevenZipAESEncryptionSettings("test1")));
10        archive.createEntry("entry2.bin", fi2, false,
11                new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(),
12                        new SevenZipAESEncryptionSettings("test2")));
13        archive.createEntry("entry3.bin", fi3, false,
14                new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(),
15                        new SevenZipAESEncryptionSettings("test3")));
16        archive.save(sevenZipFile);
17    }
18} catch(ioException ex){
19}

7Z????????

Aspose.Zip??LZMA?LZMA2?BZIP2????PPMD???????????????

?????????7Z???????????????????????????

1try(sevenziparchive archive = new SevenZiparchive( "archive.7z")){
2    archive.extracttodirectory( "extractionfolder");
3}

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.