Struct BzDecoder

pub struct BzDecoder<R> { /* private fields */ }

A decompression stream which wraps a compressed stream of data. Decompressed data will be read from the stream.

Implementations

impl<R: Read> BzDecoder<R>

fn new(r: R) -> Self

Create a new decompression stream, which will read compressed data from the given input stream and decompress it.

fn get_ref(&self) -> &R

Acquires a reference to the underlying stream

fn get_mut(&mut self) -> &mut R

Acquires a mutable reference to the underlying stream

Note that mutation of the stream may result in surprising results if this encoder is continued to be used.

fn into_inner(self) -> R

Unwrap the underlying writer, finishing the compression stream.

fn total_out(&self) -> u64

Returns the number of bytes produced by the decompressor (e.g. the number of bytes read from this stream)

Note that, due to buffering, this only bears any relation to total_in() when the decompressor reaches a sync point (e.g. where the original compressed stream was flushed). At that point, total_in() / total_out() is the compression ratio.

fn total_in(&self) -> u64

Returns the number of bytes consumed by the decompressor (e.g. the number of bytes read from the underlying stream)

Trait Implementations

impl<R: Read> Read for BzDecoder<R>

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

impl<W: Write + Read> Write for BzDecoder<W>

fn write(&mut self, buf: &[u8]) -> Result<usize>
fn flush(&mut self) -> Result<()>

Auto Trait Implementations

impl<R> Freeze for BzDecoder<R> where BzDecoder<BufReader<R>>: Freeze,

impl<R> RefUnwindSafe for BzDecoder<R> where BzDecoder<BufReader<R>>: RefUnwindSafe,

impl<R> Send for BzDecoder<R> where BzDecoder<BufReader<R>>: Send,

impl<R> Sync for BzDecoder<R> where BzDecoder<BufReader<R>>: Sync,

impl<R> Unpin for BzDecoder<R> where BzDecoder<BufReader<R>>: Unpin,

impl<R> UnsafeUnpin for BzDecoder<R> where BzDecoder<BufReader<R>>: UnsafeUnpin,

impl<R> UnwindSafe for BzDecoder<R> where BzDecoder<BufReader<R>>: UnwindSafe,

Blanket Implementations

impl<T> Any for BzDecoder<R> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for BzDecoder<R> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for BzDecoder<R> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for BzDecoder<R>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for BzDecoder<R> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for BzDecoder<R> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for BzDecoder<R> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>