Class StringCompressions


  • public class StringCompressions
    extends java.lang.Object
    Utilities related to string compression.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String gunzip​(byte[] compressed, java.nio.charset.Charset encoding)
      Un-gzip byte buffer to string.
      static byte[] gzip​(java.lang.String toCompress, java.nio.charset.Charset encoding)
      Gzip compress a given string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • gzip

        public static byte[] gzip​(java.lang.String toCompress,
                                  java.nio.charset.Charset encoding)
        Gzip compress a given string.
        Parameters:
        toCompress - String to gzip.
        encoding - Input string encoding.
        Returns:
        Gzipped byte representation.
      • gunzip

        public static java.lang.String gunzip​(byte[] compressed,
                                              java.nio.charset.Charset encoding)
        Un-gzip byte buffer to string.
        Parameters:
        compressed - Compressed buffer.
        encoding - Output string encoding.
        Returns:
        String.