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

???????????

??????????????????????????????????????? zip??????????compressionprogressed?????( getCompressionProgressprogress/ setCompressionprogressed)??????????????????????????????? ProgressEventargs????????? ???? lambda expression?????????????????????

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

zip???????????

?Compression -Progrogress???????????????ProceedBytes?????????????????????????????????????????????????????????

 1????source = new file( "gage.bin");
 2try(archive archive = new archive()){
 3    ArchiveEntry entry = archive.createentry( "Mage.bin"???source);
 4    final int []?????ready = new int [1];
 5    entry.setCompressionProgressed((sender?args) - > {
 6        int?????=(int)((100 *(long)args.getProceedBytes()) / source.length());
 7        if(?????>???????[0])
 8        {
 9            System.out.println(????? + "%??");
10            PercentReady [0] =?????;
11        }
12    });
13    archive.save( "output.zip");
14}

7z?????????????????

??????????7Z??????????????????????????????????????????????( getCompressionProgressed/ SetCompressionProgressed)

 1????source = new file( "gage.bin");
 2try(sevenziparchive archive = new SevenZiparchive(new SevenZipentrySettings(new SevenZiplzma2CompressIonsettings())){
 3    SevenziparchiveEntry entry = archive.createentry( "gage.bin"???source);
 4    final int []?????ready = new int [1];
 5    entry.setCompressionProgressed((sender?args) - > {
 6        //????Sevenziparchiveentry??
 7        int?????=(int)((100 *(long)args.getProceedBytes()) / source.length());
 8        if(?????>???????[0])
 9        {
10            System.out.println(????? + "%??");
11            PercentReady [0] =?????;
12        }
13    });
14    archive.save( "output.zip");
15}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.