flush(p1 = v1)
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
static VALUE
rb_gzwriter_flush(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, (Bytef*)"", 0, flush);
}
gzfile_write_raw(gz);
if (rb_respond_to(gz->io, id_flush)) {
rb_funcall(gz->io, id_flush, 0);
}
return obj;
}