Whole buffers v0.1.0

Source
Compressing and decompressing a whole buffer in one call.

Compress

pub func Compress(
    allocator: Allocator,
    data: byte[..],
    format: Format,
    level: Level
) -> Vector<byte> ! IoError

pub func Compress(
    allocator: Allocator,
    data: char8[..],
    format: Format,
    level: Level
) -> Vector<byte> ! IoError

Compresses text in format at level: its UTF-8 bytes, as the Io streams carry them, so text needs no cast to bytes first.

OverloadSummary
pub func Compress(allocator: Allocator, data: byte[..], format: Format, level: Level) -> Vector<byte> ! IoErrorCompresses data in format at level.
pub func Compress(allocator: Allocator, data: char8[..], format: Format, level: Level) -> Vector<byte> ! IoErrorCompresses text in format at level: its UTF-8 bytes, as the Io streams carry them, so text needs no cast to bytes first.

Source

Parameters

NameTypeDescription
allocatorAllocatorwhat the result and the compressor's buffers are kept in
databyte[..] / char8[..]the data
formatFormatthe container to write
levelLevelhow hard to compress

Returns: the compressed bytes, or fails when the allocator refused

Decompress

pub func Decompress(
    allocator: Allocator,
    data: byte[..],
    format: Format
) -> Vector<byte> ! IoError

pub func Decompress(
    allocator: Allocator,
    data: char8[..],
    format: Format
) -> Vector<byte> ! IoError

Decompresses data, a whole stream in format held as char8 units, such as bytes read from an Io stream.

OverloadSummary
pub func Decompress(allocator: Allocator, data: byte[..], format: Format) -> Vector<byte> ! IoErrorDecompresses data, a whole stream in format.
pub func Decompress(allocator: Allocator, data: char8[..], format: Format) -> Vector<byte> ! IoErrorDecompresses data, a whole stream in format held as char8 units, such as bytes read from an Io stream.

Source

Parameters

NameTypeDescription
allocatorAllocatorwhat the result and the decompressor's buffers are kept in
databyte[..] / char8[..]the compressed stream
formatFormatthe container it is in

Returns: the data, or fails with InvalidInput for damaged or truncated input