Class ZLibCompressor

    • Constructor Detail

      • ZLibCompressor

        public ZLibCompressor()
    • Method Detail

      • isCompressedBytes

        public boolean isCompressedBytes​(byte[] data)
        Check to determine if the data is compressed in the expected compression implementation

        Uses the hex magic number for zlib compression '78 01' to check if the bytes are compressed

        Specified by:
        isCompressedBytes in interface Compressor
        Parameters:
        data - - the bytes to check for compression
        Returns:
        true if the data is compressed in the expected compression implementation
      • decompressBytes

        public byte[] decompressBytes​(byte[] data)
                               throws Exception
        Description copied from interface: Compressor
        Decompresses compressed bytes, returning the uncompressed data as a byte[]
        Specified by:
        decompressBytes in interface Compressor
        Parameters:
        data - the input compressed data to decompress
        Returns:
        the decompressed bytes
        Throws:
        Exception - - The data is not compressed or the data is not compressed in the correct format
      • compressBytes

        public byte[] compressBytes​(byte[] data)
        Description copied from interface: Compressor
        Compresses bytes into compressed bytes using the compression implementation
        Specified by:
        compressBytes in interface Compressor
        Parameters:
        data - the input uncompressed data to be compressed
        Returns:
        compressed bytes