zip?tar.gz??????

Contents
[ Hide Show ]

Tar.GZ??Linux??????????????????????????Zip?Windows??????????? zip??????tar.gz???????????????????????

??

Aspose.Zip API?? Savegzipped??????????TAR???????????? �ZIP?????????????????????????????????????TAR????????????????

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

???????

?????????ZIP???????????????????tar.gz???????????????????? ?????????????????????????????????????????????

 1try(Archive source = new Archive( "source.zip")){
 2    try(tararchive tar = new Tararchive()){
 3        for(archiveentry entry:source.getentries()){
 4            if(!entry.isdirectory()){
 5                bytearrayoutputStream out = new bytearrayoutputStream();
 6                try(inputstream mem = entry.open()){
 7                    byte [] b = new byte [8192];
 8                    int bytesRead;
 9                    while(0 <(bytesread = mem.read(b?0?b.length))){
10                        out.write(b?0?bytesread);
11                    }
12                }
13                tar.createentry(entry.getName()?new bytearrayinputStream(out.tobytearray()));
14            }
15        }
16        
17        tar.saveGzipped("result.tar.gz");
18    }
19} catch(ioException ex){
20    System.out.println(ex);
21}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.