Struct lzw::DecoderEarlyChange [] [src]

pub struct DecoderEarlyChange<R: BitReader> {
    // some fields omitted
}

Decodes a lzw compressed stream using an “early change” algorithm (used in TIFF files). The maximum supported code length is 16 bits. The decoder assumes two special code word to be present in the stream:

  • CLEAR_CODE == 1 << min_code_size
  • END_CODE == CLEAR_CODE + 1

Furthermore the decoder expects the stream to start with a CLEAR_CODE. This corresponds to the implementation needed for en- and decoding GIF and TIFF files.

Methods

impl<R> DecoderEarlyChange<R> where R: BitReader
[src]

fn new(reader: R, min_code_size: u8) -> DecoderEarlyChange<R>

Creates a new LZW decoder.

fn decode_bytes(&mut self, bytes: &[u8]) -> Result<(usize, &[u8])>

Tries to obtain and decode a code word from bytes.

Returns the number of bytes that have been consumed from bytes. An empty slice does not indicate EOF.

Trait Implementations

impl<R: Debug + BitReader> Debug for DecoderEarlyChange<R>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.