Code example for GZIPOutputStream

Methods: writecloseflush

0
    { 
      long tstart = System.currentTimeMillis();
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      try 
      { 
        GZIPOutputStream gout = new GZIPOutputStream(bout);
        gout.write(in);
        gout.flush();
        gout.close();
        if (log.isDebugEnabled())
        { 
          log.debug("gzipping took " + (System.currentTimeMillis() - tstart) + " msec");
        } 
        return bout.toByteArray();
      } 
      catch (IOException io)
      { 
        log.error("io exception gzipping byte array", io);
      } 
    } 
Connect your IDE to all the code out there  Get Codota for Java