code: @SneakyThrows
      public static String compress(final String srcTxt) {
          try (val rstBao = new ByteArrayOutputStream(); val zos = new GZIPOutputStream(rstBao)) {
              zos.write(srcTxt.getBytes(StandardCharsets.UTF_8));
              zos.flush();
              zos.finish();
              val bytes = rstBao.toByteArray();
              val base64 = StringUtils.remove(EncodingUtils.encodeBase64(bytes), '\0');
              return new String(StandardCharsets.UTF_8.encode(base64).array(), StandardCharsets.UTF_8);
          }
      }
docs: Use ZipOutputStream to zip text to byte array, then convert
  byte array to base64 string, so it can be transferred via http request.
  
  @param srcTxt the src txt
  @return the string in UTF-8 format and base64'ed, or null.