pub struct Stream { /* private fields */ }
Expand description

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

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.

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.

Initialize .xz Stream encoder using a custom filter chain

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

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.

Initialize a .lzma stream decoder.

The maximum memory usage can also be specified.

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

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.

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.

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

Returns the total amount of bytes produced by this stream.

Get the current memory usage limit.

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

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

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.