inflate(p1)
public
Decompresses string. Raises a Zlib::NeedDict exception if a preset
dictionary is needed for decompression.
This method is almost equivalent to the following code:
def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end
Show source
/*
* call-seq: Zlib::Inflate.inflate(string)
*
* Decompresses +string+. Raises a Zlib::NeedDict exception if a preset
* dictionary is needed for decompression.
*
* This method is almost equivalent to the following code:
*
* def inflate(string)
* zstream = Zlib::Inflate.new
* buf = zstream.inflate(string)
* zstream.finish
* zstream.close
* buf
* end
*
*/
static VALUE
rb_inflate_s_inflate(obj, src)
VALUE obj, src;
{
struct zstream z;
VALUE dst, args[2];
int err;
StringValue(src);
zstream_init_inflate(&z);
err = inflateInit(&z.stream);
if (err != Z_OK) {
raise_zlib_error(err, z.stream.msg);
}
ZSTREAM_READY(&z);
args[0] = (VALUE)&z;
args[1] = src;
dst = rb_ensure(inflate_run, (VALUE)args, zstream_end, (VALUE)&z);
OBJ_INFECT(dst, src);
return dst;
}