Skip to content
FutureBlitz

    Install

    Import std.compress.deflate

    std.compress.deflate

    Deflate (RFC 1951), Zlib (RFC 1950), and Gzip (RFC 1952), over zlib-ng. Each one's Compress and Decompress work at once, and its Compressor and Decompressor take bytes in turn and give what came out of them so far, for data that comes in parts. Levels go from 0, stored as it is, to 9, the smallest, and are 6 by default. A Gzip Decompress reads members one after another, as gunzip does, and a Gzip Compress writes one member, with no name, time, or OS in its header.

    std/compress/deflate.fb

    Types

    Deflate struct

    Public Struct Deflate

    Deflate's raw bytes, which zip entries and PNG's data are in.

    std/compress/deflate.fb, line 28

    • @PanicsAtCaller Public Static Method Compress(data: UInt8[], level: Int = 6): UInt8[] static method #

      The data, compressed at the level. Panics when the level isn't from 0 to 9.

    • @PanicsAtCaller Public Static Method Decompress(data: UInt8[], limit: Int = MOST_BYTES): UInt8[] Throws IOError static method #

      The bytes the data is compressed from, or an IOError when it isn't Deflate's, ends too soon, or would come to more than limit bytes. Panics when the limit is negative.

    Zlib struct

    Public Struct Zlib

    Zlib's bytes: Deflate's, with a header and an Adler-32 checksum.

    std/compress/deflate.fb, line 49

    • @PanicsAtCaller Public Static Method Compress(data: UInt8[], level: Int = 6): UInt8[] static method #

      The data, compressed at the level. Panics when the level isn't from 0 to 9.

    • @PanicsAtCaller Public Static Method Decompress(data: UInt8[], limit: Int = MOST_BYTES): UInt8[] Throws IOError static method #

      The bytes the data is compressed from, or an IOError when it isn't Zlib's, ends too soon, or would come to more than limit bytes. Panics when the limit is negative.

    Gzip struct

    Public Struct Gzip

    Gzip's bytes, of .gz files and HTTP's gzip: Deflate's, with a header and a CRC-32 checksum.

    std/compress/deflate.fb, line 70

    • @PanicsAtCaller Public Static Method Compress(data: UInt8[], level: Int = 6): UInt8[] static method #

      The data, compressed at the level, as one member. Panics when the level isn't from 0 to 9.

    • @PanicsAtCaller Public Static Method Decompress(data: UInt8[], limit: Int = MOST_BYTES): UInt8[] Throws IOError static method #

      The bytes the data is compressed from, each member's after the last's, or an IOError when it isn't Gzip's, ends too soon, or would come to more than limit bytes. Panics when the limit is negative.

    DeflateCompressor class

    Public Class DeflateCompressor Implements Coder

    Deflate's bytes made in turn: Add gives what compressing the bytes it takes has made so far, and Finish what's left, which ends them, and starts again.

    std/compress/deflate.fb, line 94

    • @PanicsAtCaller Public New(level: Int = 6) constructor #

      Panics when the level isn't from 0 to 9.

    • Public Method Add(data: UInt8[]): UInt8[] method #

      What data comes to so far, which can be nothing yet.

      Doc from std.compress.codec.Coder.Add.

    • Public Method Finish(): UInt8[] method #

      What's left once all the bytes are added, which ends what it makes, and starts it again.

      Doc from std.compress.codec.Coder.Finish.

    ZlibCompressor class

    Public Class ZlibCompressor Implements Coder

    Zlib's bytes made in turn, as DeflateCompressor makes Deflate's.

    std/compress/deflate.fb, line 112

    • @PanicsAtCaller Public New(level: Int = 6) constructor #

      Panics when the level isn't from 0 to 9.

    • Public Method Add(data: UInt8[]): UInt8[] method #

      What data comes to so far, which can be nothing yet.

      Doc from std.compress.codec.Coder.Add.

    • Public Method Finish(): UInt8[] method #

      What's left once all the bytes are added, which ends what it makes, and starts it again.

      Doc from std.compress.codec.Coder.Finish.

    GzipCompressor class

    Public Class GzipCompressor Implements Coder

    Gzip's bytes made in turn, as DeflateCompressor makes Deflate's, each Finish ending a member.

    std/compress/deflate.fb, line 130

    • @PanicsAtCaller Public New(level: Int = 6) constructor #

      Panics when the level isn't from 0 to 9.

    • Public Method Add(data: UInt8[]): UInt8[] method #

      What data comes to so far, which can be nothing yet.

      Doc from std.compress.codec.Coder.Add.

    • Public Method Finish(): UInt8[] method #

      What's left once all the bytes are added, which ends what it makes, and starts it again.

      Doc from std.compress.codec.Coder.Finish.

    DeflateDecompressor class

    Public Class DeflateDecompressor Implements Coder

    Deflate's bytes taken in turn: Add gives what the bytes it takes decompress to so far, and Finish what's left once they've all been added, and starts again. Each throws an IOError when the bytes aren't Deflate's or would come to more than the limit, and Finish when they end too soon. Bytes after the end are an IOError too.

    std/compress/deflate.fb, line 151

    • @PanicsAtCaller Public New(limit: Int = MOST_BYTES) constructor #

      Panics when the limit is negative.

    • Public Method Add(data: UInt8[]): UInt8[] Throws IOError method #

      What data comes to so far, which can be nothing yet.

      Doc from std.compress.codec.Coder.Add.

    • Public Method Finish(): UInt8[] Throws IOError method #

      What's left once all the bytes are added, which ends what it makes, and starts it again.

      Doc from std.compress.codec.Coder.Finish.

    ZlibDecompressor class

    Public Class ZlibDecompressor Implements Coder

    Zlib's bytes taken in turn, as DeflateDecompressor takes Deflate's.

    std/compress/deflate.fb, line 177

    • @PanicsAtCaller Public New(limit: Int = MOST_BYTES) constructor #

      Panics when the limit is negative.

    • Public Method Add(data: UInt8[]): UInt8[] Throws IOError method #

      What data comes to so far, which can be nothing yet.

      Doc from std.compress.codec.Coder.Add.

    • Public Method Finish(): UInt8[] Throws IOError method #

      What's left once all the bytes are added, which ends what it makes, and starts it again.

      Doc from std.compress.codec.Coder.Finish.

    GzipDecompressor class

    Public Class GzipDecompressor Implements Coder

    Gzip's bytes taken in turn, as DeflateDecompressor takes Deflate's, a member after another.

    std/compress/deflate.fb, line 203

    • @PanicsAtCaller Public New(limit: Int = MOST_BYTES) constructor #

      Panics when the limit is negative.

    • Public Method Add(data: UInt8[]): UInt8[] Throws IOError method #

      What data comes to so far, which can be nothing yet.

      Doc from std.compress.codec.Coder.Add.

    • Public Method Finish(): UInt8[] Throws IOError method #

      What's left once all the bytes are added, which ends what it makes, and starts it again.

      Doc from std.compress.codec.Coder.Finish.

    Report an issue with this page or with FutureBlitz on GitHub.