Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more
Integer representing date types which Zlib::ZStream#data_type method returns
compression level 9
Which is an argument for Zlib::Deflate.new, Zlib::Deflate#deflate, and so on.
compression level 1
Which is an argument for Zlib::Deflate.new, Zlib::Deflate#deflate, and so on.
Integer representing date types which Zlib::ZStream#data_type method returns
compression level -1
Which is an argument for Zlib::Deflate.new, Zlib::Deflate#deflate, and so on.
compression method 0
Which is an argument for Zlib::Deflate.new and Zlib::Deflate#params.
Default value is 8
The integer representing memory levels. Which are an argument for Zlib::Deflate.new, Zlib::Deflate#params, and so on.
compression method 1
Which is an argument for Zlib::Deflate.new and Zlib::Deflate#params.
Oputput control - 4
The integers to control the output of the deflate stream, which are an argument for Zlib::Deflate#deflate and so on.
Output control - 3
The integers to control the output of the deflate stream, which are an argument for Zlib::Deflate#deflate and so on.
compression method 2
Which is an argument for Zlib::Deflate.new and Zlib::Deflate#params.
Maximum level is 9
The integers representing memory levels which are an argument for Zlib::Deflate.new, Zlib::Deflate#params, and so on.
The default value of windowBits which is an argument for Zlib::Deflate.new and Zlib::Inflate.new.
compression level 0
Which is an argument for Zlib::Deflate.new, Zlib::Deflate#deflate, and so on.
Output control - 0
The integers to control the output of the deflate stream, which are an argument for Zlib::Deflate#deflate and so on.
From Zlib::GzipFile#os_code - 0x01
From Zlib::GzipFile#os_code - 0x05
From Zlib::GzipFile#os_code - code of current host
From Zlib::GzipFile#os_code - 0x09
From Zlib::GzipFile#os_code - 0x07
From Zlib::GzipFile#os_code - 0x00
From Zlib::GzipFile#os_code - 0x06
From Zlib::GzipFile#os_code - 0x0c
From Zlib::GzipFile#os_code - 0x0d
From Zlib::GzipFile#os_code - 0x0a
From Zlib::GzipFile#os_code - 0x03
From Zlib::GzipFile#os_code - 0xff
From Zlib::GzipFile#os_code - 0x04
From Zlib::GzipFile#os_code - 0x02
From Zlib::GzipFile#os_code - 0x0b
From Zlib::GzipFile#os_code - 0x08
Output control - 2
The integers to control the output of the deflate stream, which are an argument for Zlib::Deflate#deflate and so on.
Integer representing date types which Zlib::ZStream#data_type method returns
The Ruby/zlib version string.
The string which represents the version of zlib.h
Calculates Adler-32 checksum for string
, and returns updated
value of adler
. If string
is omitted, it returns
the Adler-32 initial value. If adler
is omitted, it assumes
that the initial value is given to adler
.
FIXME: expression.
static VALUE rb_zlib_adler32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, adler32); }
Combine two Adler-32 check values in to one. alder1
is the
first Adler-32 value, adler2
is the second Adler-32 value.
len2
is the length of the string used to generate
adler2
.
static VALUE rb_zlib_adler32_combine(VALUE klass, VALUE adler1, VALUE adler2, VALUE len2) { return ULONG2NUM( adler32_combine(NUM2ULONG(adler1), NUM2ULONG(adler2), NUM2LONG(len2))); }
Calculates CRC checksum for string
, and returns updated value
of crc
. If string
is omitted, it returns the CRC
initial value. If crc
is omitted, it assumes that the initial
value is given to crc
.
FIXME: expression.
static VALUE rb_zlib_crc32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, crc32); }
Combine two CRC-32 check values in to one. crc1
is the first
CRC-32 value, crc2
is the second CRC-32 value.
len2
is the length of the string used to generate
crc2
.
static VALUE rb_zlib_crc32_combine(VALUE klass, VALUE crc1, VALUE crc2, VALUE len2) { return ULONG2NUM( crc32_combine(NUM2ULONG(crc1), NUM2ULONG(crc2), NUM2LONG(len2))); }
Returns the table for calculating CRC checksum as an array.
static VALUE rb_zlib_crc_table(VALUE obj) { #if !defined(HAVE_TYPE_Z_CRC_T) /* z_crc_t is defined since zlib-1.2.7. */ typedef unsigned long z_crc_t; #endif const z_crc_t *crctbl; VALUE dst; int i; crctbl = get_crc_table(); dst = rb_ary_new2(256); for (i = 0; i < 256; i++) { rb_ary_push(dst, rb_uint2inum(crctbl[i])); } return dst; }
Compresses the given string
. Valid values of level are
NO_COMPRESSION
, BEST_SPEED
,
BEST_COMPRESSION
, DEFAULT_COMPRESSION
, and an
integer from 0 to 9 (the default is 6).
This method is almost equivalent to the following code:
def deflate(string, level) z = Zlib::Deflate.new(level) dst = z.deflate(string, Zlib::NO_FLUSH) z.close dst end
See also ::inflate
static VALUE rb_deflate_s_deflate(int argc, VALUE *argv, VALUE klass) { struct zstream z; VALUE src, level, dst, args[2]; int err, lev; rb_scan_args(argc, argv, "11", &src, &level); lev = ARG_LEVEL(level); StringValue(src); zstream_init_deflate(&z); err = deflateInit(&z.stream, lev); if (err != Z_OK) { raise_zlib_error(err, z.stream.msg); } ZSTREAM_READY(&z); args[0] = (VALUE)&z; args[1] = src; dst = rb_ensure(deflate_run, (VALUE)args, zstream_end, (VALUE)&z); OBJ_INFECT(dst, src); return dst; }
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 ::deflate
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; }
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.