RAR?zip??????

Contents
[ Hide Show ]

RAR??????zip??????????????????????

??

Aspose.Zip API? Rararchive?????????RAR????????????�??????????????????????????????????zip????????????????

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

???????

?????????RAR???????????????????zip???????????????????? ????????????????????????????????????????????

 1try(?????zip = new archive()){
 2    try(rararchive rar = new Rararchive( "d:\\ archvie.rar")){
 3        for(int i = 0; i <rar.getentries()?size(); i ++){
 4            rararchiveentry entry = rar.getentries()?get(i);
 5            if(!entry.isdirectory()){
 6                try(bytearrayoutputStream out = new bytearrayoutputStream()){
 7                    entry.extraw(out);
 8                    try(bytearrayinputStream in = new bytearrayinputStream(out.tobytearray())){
 9                        zip.createentry(entry.getName()?in);
10                    }
11                }
12            } ???? {
13                zip.createentry(entry.getName() + "/"?new bytearrayinputStream(new byte [0]));
14            }
15        }
16    }
17    zip.save( "output.zip");
18} catch(ioException ex){
19    System.out.println(ex);
20}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.