Examples of GZIPInputStream


Examples of java.util.zip.GZIPInputStream

        }
    }

    private void setupDecompressionInputStream(StreamMessageContext ctx) {
        try {
            ctx.setInputStream(new GZIPInputStream(ctx.getInputStream()));
        } catch (IOException ex) {
            throw new ProtocolException(ex);
        }
    }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

    {
      String contentEncoding = contentEncodingHeader.getValue();
      if ( contentEncoding != null )
      {
        if ( contentEncoding.equalsIgnoreCase( "gzip" ) )
          return new GZIPInputStream( is );
        else if ( contentEncoding.equalsIgnoreCase( "deflate" ) )
          return new InflaterInputStream( is );
      }
    }
    return is;
View Full Code Here

Examples of java.util.zip.GZIPInputStream

    if (ZipUtil.isZipStream(in)) {
      addZip(in, baseURI, dataFormat, contexts);
    }
    else if (GZipUtil.isGZipStream(in)) {
      add(new GZIPInputStream(in), baseURI, dataFormat, contexts);
    }
    else {
      addInputStreamOrReader(in, baseURI, dataFormat, contexts);
    }
  }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

      if (formatVersion > BMSF_VERSION || formatVersion < 1) {
        throw new IOException("Incompatible format version: " + formatVersion);
      }

      // The rest of the data is GZIP-compressed
      DataInputStream dataIn = new DataInputStream(new GZIPInputStream(in));
      in = dataIn;

      int recordTypeMarker;
      while ((recordTypeMarker = dataIn.readByte()) != EOF_MARKER) {
        switch (recordTypeMarker) {
View Full Code Here

Examples of java.util.zip.GZIPInputStream

    {
        try
        {
            if ("tgz".equalsIgnoreCase(getRootName().getScheme()))
            {
                return new TarInputStream(new GZIPInputStream(new FileInputStream(file)));
            }
            else if ("tbz2".equalsIgnoreCase(getRootName().getScheme()))
            {
                return new TarInputStream(Bzip2FileObject.wrapInputStream(file.getAbsolutePath(), new FileInputStream(file)));
            }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

     * @throws IOException
     */
    public static byte[] decompress(byte[] compressedData) throws IOException {
       
        ByteArrayInputStream bis = new ByteArrayInputStream(compressedData);
        GZIPInputStream in = new GZIPInputStream(bis);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
       
        byte[] transferBuffer = new byte[4096];
        int read = 0;
        do {
            read = in.read(transferBuffer);
            if (read != -1) {
                bos.write(transferBuffer, 0, read);
            }
        } while (read != -1);
        in.close();
               
        in.close();
        bos.close();
       
        return bos.toByteArray();
    }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

  static public void uncompressFile( String filenameIn, String filenameOut, boolean inflate) throws IOException {
    long lenIn = new File(filenameIn).length();
    if (debug) System.out.println("read compressed file= "+filenameIn+ " len = "+lenIn);

    FileInputStream fin = new FileInputStream(filenameIn);
    InputStream in = (inflate) ? new InflaterInputStream(fin) : new GZIPInputStream(fin);
    in = new BufferedInputStream(in, 1000);

    FileOutputStream fout = new FileOutputStream(filenameOut);
    OutputStream out = new BufferedOutputStream(fout, 1000);
View Full Code Here

Examples of java.util.zip.GZIPInputStream

  }

  // test InflaterInputStream
  static public void unzipRandom( String filename, boolean buffer) throws IOException {
    FileInputStream fin = new FileInputStream(filename);
    InputStream in = new GZIPInputStream(fin);
    if (buffer)
      in = new BufferedInputStream(in, 1000);
    DataInputStream din = new DataInputStream(in);

    long start = System.currentTimeMillis();
View Full Code Here

Examples of java.util.zip.GZIPInputStream

        copy(in, fout, 100000);
        if (debugCompress) System.out.println("unbzipped " + filename + " to " + uncompressedFile);

      } else if (suffix.equalsIgnoreCase("gzip") || suffix.equalsIgnoreCase("gz")) {

        in = new GZIPInputStream(new FileInputStream(filename));
        copy(in, fout, 100000);

        if (debugCompress) System.out.println("ungzipped " + filename + " to " + uncompressedFile);
      }
    } catch (Exception e) {
View Full Code Here

Examples of java.util.zip.GZIPInputStream

      // check if its gzipped
      if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) {
        //is = new GZIPInputStream( new BufferedInputStream(is, 1024));
        //is = new GZIPInputStream(is);
        is = new BufferedInputStream(new GZIPInputStream(is), 1000);
      }
      if (out == null)
        count = IO.copy2null(is, bufferSize);
      else
        count = IO.copyB(is, out, bufferSize);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.