Expand description
Relative Lempel-Ziv compression against a fixed dictionary
§What is RLZ (taken from the paper)
The Relative Lempel-Ziv (RLZ) scheme is a hybrid of several phrase-based compression mechanisms. Encoding is based on a fixed-text dictionary, with all substrings within the dictionary available for use as factors, in the style of LZ77. But the dictionary is constructed in a semi-static manner, and hence needs to be representative of the entire text being coded if compression effectiveness is not to be compromised. Furthermore, because RLZ is intended for large web-based archives when constructing the dictionary, it is infeasible to have the whole input text in memory.
§Usage
use rlz::RlzCompressor;
use rlz::Dictionary;
let dict = Dictionary::from(&b"banana"[..]);
let rlz_compressor = RlzCompressor::builder().build_from_dict(dict);
let mut output = Vec::new();
let text = b"banana$aba";
let encoded_len = rlz_compressor.encode(&text[..],&mut output).unwrap();
assert_eq!(encoded_len,output.len());
let mut stored_decoder = Vec::new();
rlz_compressor.store(&mut stored_decoder).unwrap();
let loaded_decoder = RlzCompressor::load(&stored_decoder[..]).unwrap();
let mut recovered = Vec::new();
loaded_decoder.decode(&output[..],&mut recovered).unwrap();
assert_eq!(recovered,text);Re-exports§
pub use dict::Dictionary;
Modules§
- dict
- dictionary construction related items
Structs§
- Configuration
- Compression configuration
- RlzBuilder
- RLZ compressor builder
- RlzCompressor
- Main RLZ compressor class
Enums§
- Error
- RLZ Error type