?????? ? ???????? GZIP

?????

Aspose.zip ??? Java API ???????? ????????????? ?? ?????????? ?? ??????????? ???????? GZIP ? ????? ?????? ??? ???????????? ???? -???? ????? ????????? ??????.�Aspose.zip API ????? gziparchive ????? ??? ?????? ? ???????? gzip. ??? ???? ????? ????? ?????? ????????? ???????? ?? ???????.

???????? ????????? GZIP ?????????? ?? ?????????? ?????????, ???? ? ?????????? LZ77 ?? ????????? ????????.

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

????????? ??????? ???? ???????, ?? ???????? ???? ?? ????????? ?????????? Gziparchive.

1????????? (gziparchive archive = ????? gziparchive ()) {
2    Archive.setsource (DataDir + "data.bin");
3    Archive.Save (Datadir + "Archive.gz");
4}

????????? ????? GZIP

????????? ??????? ???? ???????, ?? ???????? ????? GZIP.

 1????????? (gziparchive archive = ????? gziparchive (dataDir + "archive.gz")) {
 2    ????????? (fileOutputStream extalted = ????? FileOutputStream (DataDir + "data.bin")) {
 3        InputStream ??????????? = archive.open ();
 4        ???? [] b = ????? ???? [8192];
 5        int bytesread;
 6        while (0 <(bytesread = inpacked.read (b, 0, b.length))) {
 7            ??????????.write (b, 0, bytesread);
 8        }
 9    }
10} ???? (IOException ex) {
11    System.out.println (ex);
12}

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

????????? ??????? ???? ???????, ?? ???????? ????? ?? ?????? ?? ????????? ???? ?? ByTearrayOutputStream.

 1Bytearrayoutputstream outputStream = ????? ByTeArrayOutputStream ();
 2????????? (gziparchive archive = ????? gziparchive (????? fileInputStream (DataDir + "sample.gz"))) {
 3    ???? [] b = ????? ???? [8192];
 4    int bytesread;
 5    InputStream archivestream = archive.open ();
 6    while (0 <(bytesread = archivestream.read (b, 0, b.length))) {
 7        outputstream.write (B, 0, BytesRead);
 8    }
 9    System.out.println (archive.getName ());
10} ???? (IOException ex) {
11    System.out.println (ex);
12}

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

????????? ??????? ???? ???????, ?? ???????? ?? ???????? ?? OutputStream.

1Bytearrayoutputstream outputStream = ????? ByTeArrayOutputStream ();
2????????? (gziparchive archive = ????? gziparchive ()) {
3    Archive.setsource (????? ???? (DataDir + "data.bin"));
4    Archive.Save (OutputStream);
5}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.