read(...)
public
See <a
href="/ruby/Zlib/GzipReader">Zlib::GzipReader</a>
documentation for a description.
Show source
/*
* See Zlib::GzipReader documentation for a description.
*/
static VALUE
rb_gzreader_read(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
struct gzfile *gz = get_gzfile(obj);
VALUE vlen;
int len;
rb_scan_args(argc, argv, "01", &vlen);
if (NIL_P(vlen)) {
return gzfile_read_all(gz);
}
len = NUM2INT(vlen);
if (len < 0) {
rb_raise(rb_eArgError, "negative length %d given", len);
}
return gzfile_read(gz, len);
}