Interface CompressionCodecFactory.BytesInputDecompressor

  • Enclosing interface:
    CompressionCodecFactory

    public static interface CompressionCodecFactory.BytesInputDecompressor
    Decompressor instance of a specific codec to be used for decompressing page data.

    This decompressor shall be released after use. This decompressor shall not be used after release.

    See Also:
    release()
    • Method Detail

      • decompress

        BytesInput decompress​(BytesInput bytes,
                              int decompressedSize)
                       throws IOException
        Decompresses the specified BytesInput data and returns it as BytesInput.

        The decompressed data must have the size specified. Depending on the implementation bytes might be completely consumed. The returned BytesInput instance needs to be consumed before using this decompressor again. This is because the implementation might use its internal buffer to directly provide the returned BytesInput instance.

        Parameters:
        bytes - the page data to be decompressed
        decompressedSize - the exact size of the decompressed data
        Returns:
        a BytesInput containing the decompressed data. Needs to be consumed before using this decompressor again.
        Throws:
        IOException - if any I/O error occurs during the decompression
      • decompress

        void decompress​(ByteBuffer input,
                        int compressedSize,
                        ByteBuffer output,
                        int decompressedSize)
                 throws IOException
        Decompresses compressedSize bytes from input from the current position. The decompressed bytes is to be written int output from its current position. The decompressed data must have the size specified.

        output must have the available bytes of decompressedSize. According to the ByteBuffer contract the position of input will be increased by compressedSize, and the position of output will be increased by decompressedSize. (It means, one would have to flip the output buffer before reading the decompressed data from it.)

        Parameters:
        input - the input buffer where the data is to be decompressed from
        compressedSize - the exact size of the compressed (input) data
        output - the output buffer where the data is to be decompressed into
        decompressedSize - the exact size of the decompressed (output) data
        Throws:
        IOException - if any I/O error occurs during the decompression
      • release

        void release()
        Releases this decompressor instance. No subsequent calls on this instance nor the returned BytesInput instance returned by decompress(BytesInput, int) shall be used after release.