????? java Zip ? Unzip

Aspose.zip API ????????? ??? ??????? ? ????????????????? ?????, ?? ?????????? ? ??????? ????????? ??????. ? ???? ?????? ???????? ?????? ? ?????, ? ????? ? ??????????? ??????? ??????.

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

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

1try (fileOutputStream ZipFile = new FileOutputStream (dataDir + "compressDirectory_out.zip")) {
2    ?????????? (Archive Archive = new Archive ()) {
3        File corpus = new File (dataDir + "canterrycorpus");
4        Archive.CreateEntries (??????);
5        Archive.save (Zipfile);
6    }
7} catch (ioException ex) {
8    System.out.println (Ex);
9}

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

1try (fileInputStream ZipFile = new FileInputStream (datadir + "compressDirectory_out.zip")) {
2    ?????????? (????? ????? = ????? ????? (Zipfile)) {
3        archive.extracttodirectory (datadir + "decompressfolder_out");
4    }
5} catch (ioException ex) {
6    System.out.println (Ex);
7}

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

 1try (fileOutputStream ZipFile = new FileOutputStream (datadir + "compressfilesbyfileinfo_out.zip")) {
 2    File fi1 = ????? ???? (datadir + "alice29.txt");
 3    File fi2 = ????? ???? (datadir + "fields.c");
 4    ?????????? (Archive Archive = new Archive ()) {
 5        Archive.createEntry ("alice29.txt", fi1);
 6        archive.createEntry ("fields.c", fi2);
 7        ArchivesaveOptions Options = new ArchivesaveOptions ();
 8        Options.SetencoDing (StandardCharsets.us_ascii);
 9        archive.save (zipfile, ?????);
10    }
11} catch (ioException ex) {
12    System.out.println (Ex);
13}

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

1try (fileInputStream ZipFile = new FileInputStream (datadir + "\\ urffere_password.zip")) {
2    ?????????? (????? ????? = ????? ????? (Zipfile)) {
3        archive.getEntries (). get (0) .extract (datadir + "alice29_extracted_pass_out.txt", "first_pass");
4        archive.getEntries (). get (1) .extract (datadir + "asyoulik_extracted_pass_out.txt", "second_pass");
5    }
6} catch (ioException ex) {
7    System.out.println (Ex);
8}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.