Module compress::lz4
[−]
[src]
LZ4 Decompression and Compression. Requires lz4
feature, enabled by default
This module contains an implementation in Rust of decompression and compression
of LZ4-encoded streams. These are exposed as a standard Reader
and Writer
interfaces wrapping an underlying stream.
Example
use compress::lz4; use std::fs::File; use std::path::Path; use std::io::Read; let stream = File::open(&Path::new("path/to/file.lz4")).unwrap(); let mut decompressed = Vec::new(); lz4::Decoder::new(stream).read_to_end(&mut decompressed);
Credit
This implementation is largely based on Branimir Karadžić's implementation which can be found at https://github.com/bkaradzic/go-lz4.
Structs
Decoder |
This structure is used to decode a stream of LZ4 blocks. This wraps an internal reader which is read from when this decoder's read method is called. |
Encoder |
This structure is used to compress a stream of bytes using the LZ4 compression algorithm. This is a wrapper around an internal writer which bytes will be written to. |
Functions
compression_bound |
Returns maximum possible size of compressed output given source size |
decode_block |
Decodes pure LZ4 block into output. Returns count of bytes processed. |
encode_block |
Encodes input into pure LZ4 block. Return count of bytes processed. |