TempBuffer.free(buf);
  public Value gzcompress(InputStream data,                          @Optional("6") int level)  {    try {      Deflater deflater = new Deflater(level, true);      Adler32 crc = new Adler32();      TempBuffer buf = TempBuffer.allocate();      byte []buffer = buf.getBuffer();      boolean isFinished = false;      TempStream out = new TempStream();      buffer[0] = (byte) 0x78;      if (level <= 1)	buffer[1] = (byte) 0x01;      else if (level < 6)	buffer[1] = (byte) 0x5e;      else if (level == 6)	buffer[1] = (byte) 0x9c;      else	buffer[1] = (byte) 0xda;      out.write(buffer, 0, 2, false);      while (! isFinished) {	while (! isFinished && deflater.needsInput()) {	  int len = data.read(buffer, 0, buffer.length);	  if (len > 0) {	    crc.update(buffer, 0, len);	    deflater.setInput(buffer, 0, len);	  }	  else {	    isFinished = true;	    deflater.finish();	  }	}	int len;	while ((len = deflater.deflate(buffer, 0, buffer.length)) > 0) {	  out.write(buffer, 0, len, false);	}      }      long value = crc.getValue();          buffer[0] = (byte) (value >> 24);      buffer[1] = (byte) (value >> 16);      buffer[2] = (byte) (value >> 8);      buffer[3] = (byte) (value >> 0);          out.write(buffer, 0, 4, true);          TempBuffer.free(buf);      return new TempBufferStringValue(out.getHead());    } catch (Exception e) {      throw QuercusModuleException.create(e);    }  }