????????????? ?????? Unix ? Java

?????

Xz, bzip2 ? lzip ?????????????? ? Linux. ?? -?? ????? ??????? ????????? ?? ????? ????? ? ????????? ???????.�Aspose.zip API ????????????? ????? SetCompressionThreads ‘??? ???? ?? ??? ??? ????????????? ?????????? ???? ?? ??? ??????. ????????? ??? ?? ????? ??? ???? ?????? ?? ????? ????????????? ??????; ???????? ??? - ????? ?? ????????? - ???????? ? ?????? ? ??????? ?????? CPU Core.

xz ????????????? ??????

?????????? ????? setCompressionThreads ? xzarchivesttings. ? ????????? ??????? ???? ????????, ??? ????? ???? ? ?????????????? ?????????? xzarchive.

 1try (fileOutputStream xzFile = new FileOutputStream ("archive.xz")) {
 2    try (fileInputStream Source = new FileInputStream ("data.bin")) {
 3        Xzarchivesettings settings = new xzarchivesettings ();
 4        ?????????.setchecktype (xchecktype.crc32);
 5        settings.setCompressionThreads (4);
 6        ?????????? (xzarchive archive = new xzarchive (settings)) {
 7            archive.setsource (????????);
 8            Archive.save (xzfile);
 9        }
10    }
11} catch (ioException ex) {
12}

BZIP2 ????????????? ??????

?????????? ????? setCompressionThreads ? bzip2saveoptions. ? ????????? ??????? ???? ????????, ??? ????? ???? ? ?????????????? ?????????? Bzip2archive.

 1try (fileOutputStream bz2file = new FileOutputStream ("archive.bz2")) {
 2    try (fileInputStream Source = new FileInputStream ("data.bin")) {
 3        try (bzip2archive archive = new bzip2archive ()) {
 4            archive.setsource (????????);
 5            ????? BZIP2SaveOptions = ????? BZIP2SaveOptions (9);
 6            Options.SetCompressionThreads (4);
 7            Archive.save (bz2file, ????????);
 8        }
 9    }
10} catch (ioException ex) {
11}

LZIP ????????????????? ??????

?????????? ????? setCompressionThreads ? lziparchivesettings. ? ????????? ??????? ???? ????????, ??? ????? ???? ? ?????????????? ?????????? Lziparchive.

 1try (fileOutputStream lzFile = new FileOutputStream ("archive.lz")) {
 2    try (fileInputStream Source = new FileInputStream ("data.bin")) {
 3        Lziparchivesettings Settings = ????? lziparchivesttings (16777216);
 4        settings.setCompressionThreads (4);
 5        ?????????? (lziparchive archive = new lziparchive (settings)) {
 6            archive.setsource (????????);
 7            Archive.save (lzfile);
 8        }
 9    }
10} catch (ioException ex) {
11}

?????? ?????? ???????????? ?? ???? ????????.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.