[][src]Struct xz::stream::Stream

pub struct Stream { /* fields omitted */ }

Representation of an in-memory LZMA encoding or decoding stream.

Wraps the raw underlying lzma_stream type and provides the ability to create streams which can either decode or encode various LZMA-based formats.

Implementations

impl Stream[src]

pub fn new_easy_encoder(preset: u32, check: Check) -> Result<Stream, Error>[src]

Initialize .xz stream encoder using a preset number

This is intended to be used by most for encoding data. The preset argument is a number 0-9 indicating the compression level to use, and normally 6 is a reasonable default.

The check argument is the integrity check to insert at the end of the stream. The default of Crc64 is typically appropriate.

pub fn new_lzma_encoder(options: &LzmaOptions) -> Result<Stream, Error>[src]

Initialize .lzma encoder (legacy file format)

The .lzma format is sometimes called the LZMA_Alone format, which is the reason for the name of this function. The .lzma format supports only the LZMA1 filter. There is no support for integrity checks like CRC32.

Use this function if and only if you need to create files readable by legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format (the new_easy_encoder function) is strongly recommended.

The valid action values for process are Run and Finish. No kind of flushing is supported, because the file format doesn't make it possible.

pub fn new_stream_encoder(
    filters: &Filters,
    check: Check
) -> Result<Stream, Error>
[src]

Initialize .xz Stream encoder using a custom filter chain

This function is similar to new_easy_encoder but a custom filter chain is specified.

pub fn new_stream_decoder(memlimit: u64, flags: u32) -> Result<Stream, Error>[src]

Initialize a .xz stream decoder.

The maximum memory usage can be specified along with flags such as TELL_ANY_CHECK, TELL_NO_CHECK, TELL_UNSUPPORTED_CHECK, TELL_IGNORE_CHECK, or CONCATENATED.

pub fn new_lzma_decoder(memlimit: u64) -> Result<Stream, Error>[src]

Initialize a .lzma stream decoder.

The maximum memory usage can also be specified.

pub fn new_auto_decoder(memlimit: u64, flags: u32) -> Result<Stream, Error>[src]

Initialize a decoder which will choose a stream/lzma formats depending on the input stream.

pub fn process(
    &mut self,
    input: &[u8],
    output: &mut [u8],
    action: Action
) -> Result<Status, Error>
[src]

Processes some data from input into an output buffer.

This will perform the appropriate encoding or decoding operation depending on the kind of underlying stream. Documentation for the various action arguments can be found on the respective variants.

pub fn process_vec(
    &mut self,
    input: &[u8],
    output: &mut Vec<u8>,
    action: Action
) -> Result<Status, Error>
[src]

Performs the same data as process, but places output data in a Vec.

This function will use the extra capacity of output as a destination for bytes to be placed. The length of output will automatically get updated after the operation has completed.

pub fn total_in(&self) -> u64[src]

Returns the total amount of input bytes consumed by this stream.

pub fn total_out(&self) -> u64[src]

Returns the total amount of bytes produced by this stream.

pub fn memlimit(&self) -> u64[src]

Get the current memory usage limit.

This is only supported if the underlying stream supports a memlimit.

pub fn set_memlimit(&mut self, limit: u64) -> Result<(), Error>[src]

Set the current memory usage limit.

This can return Error::MemLimit if the new limit is too small or Error::Program if this stream doesn't take a memory limit.

Trait Implementations

impl Drop for Stream[src]

impl Send for Stream[src]

impl Sync for Stream[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.