flush(...)
public
Flushes all the internal buffers of the GzipWriter object. The meaning of
flush is same as in
Zlib::Deflate#deflate. Zlib::SYNC_FLUSH is used if flush is omitted. It is no use
giving flush
Zlib::NO_FLUSH.
Show source
/*
* call-seq: flush(flush=nil)
*
* Flushes all the internal buffers of the GzipWriter object. The meaning of
* +flush+ is same as in Zlib::Deflate#deflate. <tt>Zlib::SYNC_FLUSH</tt> is used if
* +flush+ is omitted. It is no use giving flush <tt>Zlib::NO_FLUSH</tt>.
*/
static VALUE
rb_gzwriter_flush(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
struct gzfile *gz = get_gzfile(obj);
VALUE v_flush;
int flush;
rb_scan_args(argc, argv, "01", &v_flush);
flush = FIXNUMARG(v_flush, Z_SYNC_FLUSH);
if (flush != Z_NO_FLUSH) { /* prevent Z_BUF_ERROR */
zstream_run(&gz->z, "", 0, flush);
}
gzfile_write_raw(gz);
if (rb_respond_to(gz->io, id_flush)) {
rb_funcall(gz->io, id_flush, 0);
}
return obj;
}