Decompressing v0.1.0
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.
Associated functions
New
pub func New(
allocator: Allocator,
source: Reader,
format: Format
) -> DecompressReader ! IoError
A reader of the data source holds compressed in format.
| Name | Type | Description |
|---|---|---|
allocator | Allocator | what the reader's input buffer and history are kept in |
source | Reader | the compressed stream, which the reader takes |
format | Format | the container the stream is in |
Returns: the reader, or fails when the allocator refused
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.
| Name | Type | Description |
|---|---|---|
into | var 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
Destructor
~DecompressReader
func ~DecompressReader(self: &var DecompressReader)