Learn R Programming

libdeflate (version 1.24-7)

deflate_decompress: Decompress a raw vector with libdeflate

Description

Decompress a raw DEFLATE stream to its original length.

Usage

deflate_decompress(decompressor, input, out_len)

Value

A raw vector of length `out_len` containing the decompressed data.

Arguments

decompressor

An external pointer created by `alloc_decompressor()`.

input

A raw vector containing the compressed DEFLATE stream.

out_len

Integer giving the expected uncompressed length (in bytes).

Examples

Run this code
# round-trip example
msg = "Round-trip test: 123123123123"
raw_in = charToRaw(msg)
cmp = alloc_compressor(12L)
raw_cmp = deflate_compress(cmp, raw_in)
dcmp = alloc_decompressor()
raw_out = deflate_decompress(dcmp, raw_cmp, length(raw_in))
stopifnot(identical(raw_out, raw_in))

Run the code above in your browser using DataLab