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

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

?????? ????????? ???? ??????? ???????? ???, ???????? ???? ?????? ????? ??????????. ??? Zip Archive ???????????? ????? `CompressionProgress ‘( GetCompressionProgress/ setCompressionProgressed) ?????????? ? ??????????. ?? ????? ?????????? ?? ProgressEventArgs, ???? ??????? ????????? ?????? ?????? ????. ??? ?? ?? ?????? ??????????? ?? ?? ????? ?? ????????? Lambda Expression:

1entry.setCompressionProgress ((??????????, args) -> {
2    System.out.println (args.getProceedBytes () + "????? ????????");
3});

???? ??? ???????? ???????? ZIP

??????, ???? “CompressionProgress” ????? ????????????, ?? ?????????? ????? “???????????” ?? ??????? ????????? ?????. ???? ?? ????????? ?????????????? ????????? ???? ?? ????? ??????. ??? ?????? ??????.

 1??????? ????? = ????? ???? ("??????????.bin");
 2????????? (????? ????? = ????? ????? ()) {
 3    ArchiveEntry entry = archive.createEntry ("??????????.bin", ???????);
 4    ???????? int [] ???????? = ????? int [1];
 5    entry.setCompressionProgress ((??????????, args) -> {
 6        int ????????? = (int) ((100 * (??????) args.getproceededbytes ()) / source.length ());
 7        ???? (????????> ???????? [0])
 8        {
 9            System.out.println (???????? + "% ??????????");
10            ???????? [0] = ????????;
11        }
12    });
13    Archive.save ("output.zip");
14}

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

???????? ?????? ??????????? ??? ?????? 7Z. ???? ????? ??? ?????? ?????? ????????? ?? ???????????? ????? ( GetCompressionProgress/ SetCompressionProgred)

 1??????? ????? = ????? ???? ("??????????.bin");
 2????????? (Sevenziparchive Archive = ????? ???????????? (???? SewzipentrySettings (New Sevenziplzma2Compressionsettings ())) {
 3    Sevenziparchiveentry entry = archive.createEntry ("??????????.bin", ???????);
 4    ???????? int [] ???????? = ????? int [1];
 5    entry.setCompressionProgress ((??????????, args) -> {
 6        // ?????????? - ?? ????????????????
 7        int ????????? = (int) ((100 * (??????) args.getproceededbytes ()) / source.length ());
 8        ???? (????????> ???????? [0])
 9        {
10            System.out.println (???????? + "% ??????????");
11            ???????? [0] = ????????;
12        }
13    });
14    Archive.save ("output.zip");
15}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.