new(p1 = v1, p2 = v2, p3 = v3, p4 = v4)
public
Creates a new deflate stream for compression. See
zlib.h for details of each argument. If an argument is nil, the default
value of that argument is used.
TODO: document better!
Show source
static VALUE
rb_deflate_initialize(int argc, VALUE *argv, VALUE obj)
{
struct zstream *z;
VALUE level, wbits, memlevel, strategy;
int err;
rb_scan_args(argc, argv, "04", &level, &wbits, &memlevel, &strategy);
Data_Get_Struct(obj, struct zstream, z);
err = deflateInit2(&z->stream, ARG_LEVEL(level), Z_DEFLATED,
ARG_WBITS(wbits), ARG_MEMLEVEL(memlevel),
ARG_STRATEGY(strategy));
if (err != Z_OK) {
raise_zlib_error(err, z->stream.msg);
}
ZSTREAM_READY(z);
return obj;
}