Skip to content
FutureBlitz

    Install

    Import std.compress.stream

    CoderReader

    std.compress.stream

    class

    Public Class CoderReader Implements Reader

    A Reader whose bytes are what another Reader's come to through a Coder, as CoderReader(file, GzipDecompressor()) reads a .gz file's: it reads the other Reader a chunk at a time, and once that ends, gives what the Coder has left, and then ends. Read throws the IOError the Coder or the Reader does, like a Decompressor's for bytes that aren't its format, or that end early, and a Read after that throws again, or ends.

    Examples

    Local gz = Gzip.Compress("read back".Bytes)
    Local reader = CoderReader(MemoryStream(gz), GzipDecompressor())
    Expect(Try ReadAllText(reader) == "read back")

    std/compress/stream.fb, line 77

    • Public New(inner: Reader, through: Coder) constructor #

      A CoderReader that reads what through makes of what inner gives.

    • Public Method Read(into: Buffer<UInt8>): Int64 Throws IOError method #

      Reads what the other Reader's bytes come to through the Coder into into, and gives how many it read, or 0 once both have ended. Throws the IOError the Coder or the other Reader does.

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