@Deprecated
    public static String compress(String text) throws IOException {
        String result;
        if (text != null && text.length() > 0) {
            try (ByteArrayOutputStream baos = new ByteArrayOutputStream(text.length());
                 GZIPOutputStream gzipos = new GZIPOutputStream(baos);) {
                gzipos.write(text.getBytes(UTF_8));
                gzipos.close();
                baos.close();
                // result = (new BASE64Encoder()).encode(baos.toByteArray());
                result = Base64.encodeBase64String(baos.toByteArray());
                /* TODO
                Replace result raw to this one : result = Base64.encodeBase64String(baos.toByteArray());
                See :
                Should not be using classes that are in sun.* packages - those classes are not part of the public API
                Java and can change in any new Java version
                http://stackoverflow.com/questions/29692146/java-lang-noclassdeffounderror-sun-misc-base64encoder
                http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html
                */
            }
        } else {
            result = text;
        }
        return result;
    }
@ Deprecated public static String compress ( String text ) throws IOException { String result ; if ( text != null && text . length ( ) > 0 ) { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( text . length ( ) ) ; GZIPOutputStream gzipos = new GZIPOutputStream ( baos ) ; ) { gzipos . write ( text . getBytes ( UTF_8 ) ) ; gzipos . close ( ) ; baos . close ( ) ; result = Base64 . encodeBase64String ( baos . toByteArray ( ) ) ; } } else { result = text ; } return result ; }
The method compresses the string using gzip.

@param text The string to compress.
@return The compressed string.
@throws java.io.IOException Does some thing in old style.
@deprecated use {@link #compressString(String)} instead.