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

?????

7-Zip-??? ??????? ????? ? ??????? ????????????? ??????. Aspose.zip API ????????? ???????? ? ????????? ? ??????????? 7-ZIP-???????? ? ????? ??????????? ??? ????????????? ?????-???? ?????? ????????? ??????????.�Aspose.zip API ????????????? Sevenziparchive ????? ??? ?????? ? 7-zip-????????.�???? ????? ????????????? ????????? ?????? ??? ?????????? ???????? ? ???????.�API ????????????? ????? SevenziparchiveEntry ???????????? ????? ???? ???? ? ?????? 7Z.

???????? 7-Zip Single intry

? ????????? ??????? ???? ???????????????, ??? ??????? 7-zip-?????? ? ?????????????? ?????????? Sevenziparchive.

1try (fileOutputStream SevenziPfile = new FileOutputStream ("archive.7z")) {
2    ?????????? (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-???????? ??????.

1?????????? (Sevenziparchive Archive = new Sevenziparchive ()) {
2    archive.createentries ("datadir");
3    Archive.save ("Sevenzip.7Z");
4}

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

Aspose.zip API ????????????? Sevenzipaesencryptionsettings ?????, ??????? ????????????? ????????? ??? ?????????? ??? ???????????? AES ??? ??????? 7Z. ????????? ?????? ???? ?????????????, ??? ???????????? ????????? ?????????? AES.

1?????????? (Sevenziparchive Archive = new Sevenziparchive (new 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.

7-Zip ????? ? ??????? LZMA

????????? ?????? ???? ?????????????, ??? ??????? ????? 7Z ? ??????? LZMA ? ?????????? AES.

 1try (fileOutputStream SevenziPfile = new FileOutputStream ("archive.7z")) {
 2    ?????????? (Sevenziparchive Archive = new Sevenziparchive ()) {
 3        Archive.createEntry ("inpit1.bin",
 4                New BytearrayinputStream (New Byte [] {0x00, (byte) 0xff}),
 5                New SevenzipentrySettings (new Sevenziplzmacompressionsettings (),
 6                        ????? Sevenzipaesencryptionsettings ("test1")),
 7                ????? ???? ("data1.bin"));
 8        Archive.save (Sevenzipfile);
 9    }
10} catch (ioException ex) {
11}

????? ??? ?? ?? ?????? ????????? 7Z -????? ? ??????? ?????? BZIP2, PPMD ??? LZMA2 ??? ??????? ????? ??? ??????.

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

????????? ?????? ???? ?????????????, ??? ??????? ????? ? ????????, ?????????????? ? ?????????? ???????? ??? ?????? ??????.

 1try (fileOutputStream SevenziPfile = new FileOutputStream ("archive.7z")) {
 2    File fi1 = ????? ???? ("data1.bin");
 3    File fi2 = ????? ???? ("data2.bin");
 4    ???? fi3 = ????? ???? ("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 ????? ? ???????.

1?????????? (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.