class StringExt {

    public static String gzipAndBase64Encode(String s) {
        if (StringExt.isEmpty(s)) {
            return s;
        }
        try (
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                GZIPOutputStream gzip = new GZIPOutputStream(out);
        ) {
            gzip.write(s.getBytes());
            gzip.finish();
            return Base64.getEncoder().encodeToString(out.toByteArray());
        } catch (Exception e) {
            throw ExceptionExt.rethrow(e);
        }
    }

    private  StringExt();

}