Zlib
Struct · namespace System.Compression · Since 0.28
struct ZlibDeflate data in the zlib container (RFC 1950): a 2-byte header, the data and the Adler-32 checksum. PNG images keep their pixels like this.
Static methods
Section titled “Static methods”| Name | Description |
|---|---|
Compress |
data compressed with level 6. |
Decompress |
The bytes of the zlib data data; the checksum is checked. |
Compress
Section titled “Compress”static uint8[] Compress(ReadOnlySlice<uint8> data)data compressed with level 6.
static uint8[] Compress(ReadOnlySlice<uint8> data, int level)data compressed with level (0 to 9, see Deflate.Compress).
Panics when level is not 0 to 9.
Decompress
Section titled “Decompress”static CompressionError<uint8[]> Decompress(ReadOnlySlice<uint8> data)The bytes of the zlib data data; the checksum is checked. Bytes after the checksum are ignored.
Errors
CompressionError.InvalidData: the header is not one of zlib (or asks for a preset dictionary), or the deflate data is not valid.CompressionError.Truncated:dataends before the end of the stream or its checksum.CompressionError.ChecksumMismatch: the Adler-32 checksum does not match.