Trait ReadCompression

Source
pub trait ReadCompression<R: Read> {
    // Required methods
    fn magic(&self) -> [u8; 5];
    fn meta(&self) -> &CodecMetadata;
    fn meta_mut(&mut self) -> &mut CodecMetadata;
    fn read_bytes(
        &mut self,
        bytes: &mut [u8],
        reader: &mut BitReader<R, BigEndian>,
    ) -> Result<()>;
    fn digest_event(
        &mut self,
        reader: &mut BitReader<R, BigEndian>,
    ) -> Result<Event, CodecError>;
    fn set_input_stream_position(
        &mut self,
        reader: &mut BitReader<R, BigEndian>,
        position: u64,
    ) -> Result<(), CodecError>;
}
Expand description

A trait for reading ADΔER data from a stream.

A struct implementing ReadCompression does not take ownership of the read handle. Subsequent calls to the compressor will pass the read handle each time. The caller is responsible for maintaining the reader.

Required Methods§

Source

fn magic(&self) -> [u8; 5]

Returns the magic number for the codec

Source

fn meta(&self) -> &CodecMetadata

Returns a reference to the metadata

Source

fn meta_mut(&mut self) -> &mut CodecMetadata

Returns a mutable reference to the metadata

Source

fn read_bytes( &mut self, bytes: &mut [u8], reader: &mut BitReader<R, BigEndian>, ) -> Result<()>

Read a certain number of bytes from the stream, indicated by the size of the buffer passed.

Source

fn digest_event( &mut self, reader: &mut BitReader<R, BigEndian>, ) -> Result<Event, CodecError>

Read the next event from the stream. Returns None if the stream is exhausted.

Source

fn set_input_stream_position( &mut self, reader: &mut BitReader<R, BigEndian>, position: u64, ) -> Result<(), CodecError>

Set the input stream position to the given byte offset.

Implementors§