code: private static InputStreamWithMetadata compressStreamWithGZIPNoDigest(
        InputStream inputStream) throws SnowflakeSQLException
    {
      try
      {
        FileBackedOutputStream tempStream =
            new FileBackedOutputStream(MAX_BUFFER_SIZE, true);
  
        CountingOutputStream countingStream =
            new CountingOutputStream(tempStream);
  
        // construct a gzip stream with sync_flush mode
        GZIPOutputStream gzipStream;
  
        gzipStream = new GZIPOutputStream(countingStream, true);
  
        IOUtils.copy(inputStream, gzipStream);
  
        inputStream.close();
  
        gzipStream.finish();
        gzipStream.flush();
  
        countingStream.flush();
  
        return new InputStreamWithMetadata(countingStream.getCount(),
                                           null, tempStream);
  
      }
      catch (IOException ex)
      {
        logger.error("Exception compressing input stream", ex);
  
        throw new SnowflakeSQLException(ex, SqlState.INTERNAL_ERROR,
                                        ErrorCode.INTERNAL_ERROR.getMessageCode(),
                                        "error encountered for compression");
      }
  
    }
docs: Compress an input stream with GZIP and return the result size, digest and
  compressed stream.
  
  @param inputStream
  @return the compressed stream
  @throws SnowflakeSQLException
  @deprecated Can be removed when all accounts are encrypted