Class ZLIBCodec


  • final class ZLIBCodec
    extends java.lang.Object
    Codec methods for compressing and uncompressing using ZLIB.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int BUFFER_SIZE
      Size of the internal buffer when decoding.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ZLIBCodec()
      Prevent construction.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(byte[] compressed)
      Uncompress/decode the data provided using the ZLIB format.
      static byte[] encode​(byte[] data)
      Compress/encode the data provided using the ZLIB format.
      static java.lang.String getID()
      Returns the name of the codec.
      • Methods inherited from class java.lang.Object

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

      • BUFFER_SIZE

        private static final int BUFFER_SIZE
        Size of the internal buffer when decoding.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ZLIBCodec

        private ZLIBCodec()
        Prevent construction.
    • Method Detail

      • getID

        public static java.lang.String getID()
        Returns the name of the codec.
        Returns:
        string name of the codec (i.e., "deflate")
      • encode

        public static byte[] encode​(byte[] data)
                             throws java.io.IOException
        Compress/encode the data provided using the ZLIB format.
        Parameters:
        data - data to compress
        Returns:
        compressed data
        Throws:
        java.io.IOException - on compression failure
      • decode

        public static byte[] decode​(byte[] compressed)
                             throws java.io.IOException
        Uncompress/decode the data provided using the ZLIB format.
        Parameters:
        data - data to uncompress
        Returns:
        uncompressed data
        Throws:
        java.io.IOException - on decompression failure