pub fn encode<W, I>(input: I, writer: BufWriter<W>, level: usize) -> Result<usize>where
    I: AsRef<[u8]>,
    W: Write,
Expand description

bzip2 encode a buffer and write the output to a BufWriter

level must be in 1..=9 and describes the block size. That is: the block size is level * 100_000. The usual default is 9.

Returns the number of input bytes encoded.