Decompressing v0.1.0

Source
A reader that decompresses a stream as it is read.

DecompressReader

pub struct DecompressReader {
    // private fields
}

A reader that decompresses what it reads from another, in any of the three formats. Reading it to the end fails with EndOfStream once the data and its checksum have been read; damaged or truncated input fails with InvalidInput, and so does every read after. A gzip stream of several members reads as their data one after another. Not copied.

Source

Associated functions

New

pub func New(
    allocator: Allocator,
    source: Reader,
    format: Format
) -> DecompressReader ! IoError

A reader of the data source holds compressed in format.

NameTypeDescription
allocatorAllocatorwhat the reader's input buffer and history are kept in
sourceReaderthe compressed stream, which the reader takes
formatFormatthe container the stream is in

Returns: the reader, or fails when the allocator refused

Source

Implements Reader

DecompressReader conforms to Reader.

Read

pub func Read(
    self: &var DecompressReader,
    into: var char8[..]
) -> uint ! IoError

Decompresses into into until it is full or the data ends.

NameTypeDescription
intovar char8[..]where to put the data

Returns: how many bytes were produced, or fails with EndOfStream after the last, or with InvalidInput for damaged or truncated input

Source

Destructor

~DecompressReader

func ~DecompressReader(self: &var DecompressReader)

Source