class Compress::Zlib::Writer
inherits IO
¶
A write-only IO
object to compress data in the zlib format.
Instances of this class wrap another IO object. When you write to this instance, it compresses the data and writes it to the underlying IO.
Note
unless created with a block, close
must be invoked after all
data has been written to a Zlib::Writer instance.
Class methods¶
.open(io : IO, level = Zlib::DEFAULT_COMPRESSION, sync_close = false, dict : Bytes? = nil
¶
(io : IO, level = Zlib::DEFAULT_COMPRESSION, sync_close = false, dict : Bytes? = nil
Creates a new writer to the given io, yields it to the given block, and closes it at the end.
.open(filename : String, level = Zlib::DEFAULT_COMPRESSION, dict : Bytes? = nil
¶
(filename : String, level = Zlib::DEFAULT_COMPRESSION, dict : Bytes? = nil
Creates a new writer to the given filename, yields it to the given block, and closes it at the end.
.new(io : IO, level = Zlib::DEFAULT_COMPRESSION, sync_close = false, dict : Bytes? = nil)
¶
(io : IO, level = Zlib::DEFAULT_COMPRESSION, sync_close = false, dict : Bytes? = nil)
Creates a new writer to the given io.
.new(filename : String, level = Zlib::DEFAULT_COMPRESSION, dict : Bytes? = nil)
¶
(filename : String, level = Zlib::DEFAULT_COMPRESSION, dict : Bytes? = nil)
Creates a new writer to the given filename.
Methods¶
#flush
¶
Flushes data, forcing writing the zlib header if no data has been written yet.
See IO#flush
.