Import std.compress.stream
CoderWriter
class
Public Class CoderWriter Implements Writer
A Writer whose bytes go through a Coder to another Writer: Write adds them to the Coder and
writes what comes of them, and Finish writes the rest, which ends what the Coder makes, as
CoderWriter(file, GzipCompressor()) ends a gzip member. A Coder holds on to what it hasn't
coded, so Flush flushes only the other Writer, and the Coder's rest comes with Finish. Each
throws the IOError the Coder or the Writer does.
Examples
Local memory = MemoryStream()
Local writer = CoderWriter(memory, GzipCompressor())
Try writer.WriteText("written a part at a time")
Try writer.Finish()
Expect(String.FromUtf8(Try Gzip.Decompress(memory.ToArray())) == "written a part at a time")std/compress/stream.fb, line 33
-
A CoderWriter that writes to
innerwhatthroughmakes of the bytes it's given. -
Puts the bytes through the Coder, and writes what comes of them so far to the other Writer.
-
Flushes the other Writer, but not the Coder, whose rest comes with Finish.
-
Writes what the Coder has left, and flushes the other Writer. The Coder starts again, so what's written next is coded on its own, as a gzip's next member is.
Report an issue with this page or with FutureBlitz on GitHub.