Method: Zlib.inflate
- Defined in:
-
ext/zstdlib/ruby/zlib-2.2/zlib.c,
ext/zstdlib/ruby/zlib-2.3/zlib.c,
ext/zstdlib/ruby/zlib-2.4/zlib.c,
ext/zstdlib/ruby/zlib-2.5/zlib.c,
ext/zstdlib/ruby/zlib-2.6/zlib.c
call-seq:
Zlib.inflate(string)
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
See also Zlib.deflate
1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 |
# File 'ext/zstdlib/ruby/zlib-2.2/zlib.c', line 1940 static VALUE rb_inflate_s_inflate(VALUE obj, VALUE 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; } |