Interface Compressor

  • All Known Implementing Classes:
    ZLibCompressor

    public interface Compressor
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] compressBytes​(byte[] data)
      Compresses bytes into compressed bytes using the compression implementation
      byte[] compressBytes​(byte[] data, int initialBufferCapacity)
      Compresses bytes into compressed bytes using the compression implementation
      byte[] decompressBytes​(byte[] data)
      Decompresses compressed bytes, returning the uncompressed data as a byte[]
      boolean isCompressedBytes​(byte[] data)
      Check to determine if the data is compressed in the expected compression implementation
    • Method Detail

      • isCompressedBytes

        boolean isCompressedBytes​(byte[] data)
        Check to determine if the data is compressed in the expected compression implementation
        Parameters:
        data - - the bytes to check for compression
        Returns:
        true if the data is compressed in the expected compression implementation
      • decompressBytes

        byte[] decompressBytes​(byte[] data)
                        throws Exception
        Decompresses compressed bytes, returning the uncompressed data as a byte[]
        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

        byte[] compressBytes​(byte[] data)
        Compresses bytes into compressed bytes using the compression implementation
        Parameters:
        data - the input uncompressed data to be compressed
        Returns:
        compressed bytes
      • compressBytes

        byte[] compressBytes​(byte[] data,
                             int initialBufferCapacity)
        Compresses bytes into compressed bytes using the compression implementation
        Parameters:
        data - the input uncompressed data to be compressed
        initialBufferCapacity - the initial capacity of the buffer storing the compressed data. It depends on the data type and the caller may know the expected average compression factor. If this initial capacity is smaller than 16, the buffer capacity will be 16 anyway.
        Returns:
        compressed bytes