| Module | Zlib |
| In: |
zlib/zlib.c
|
The Zlib module contains several classes for compressing and decompressing streams, and for working with "gzip" files.
Following are the classes that are most likely to be of interest to the user: Zlib::Inflate Zlib::Deflate Zlib::GzipReader Zlib::GzipWriter
There are two important base classes for the classes above: Zlib::ZStream and Zlib::GzipFile. Everything else is an error class.
Here’s a list.
Zlib::VERSION
The Ruby/zlib version string.
Zlib::ZLIB_VERSION
The string which represents the version of zlib.h.
Zlib::BINARY
Zlib::ASCII
Zlib::UNKNOWN
The integers representing data types which Zlib::ZStream#data_type
method returns.
Zlib::NO_COMPRESSION
Zlib::BEST_SPEED
Zlib::BEST_COMPRESSION
Zlib::DEFAULT_COMPRESSION
The integers representing compression levels which are an argument
for Zlib::Deflate.new, Zlib::Deflate#deflate, and so on.
Zlib::FILTERED
Zlib::HUFFMAN_ONLY
Zlib::DEFAULT_STRATEGY
The integers representing compression methods which are an argument
for Zlib::Deflate.new and Zlib::Deflate#params.
Zlib::DEF_MEM_LEVEL
Zlib::MAX_MEM_LEVEL
The integers representing memory levels which are an argument for
Zlib::Deflate.new, Zlib::Deflate#params, and so on.
Zlib::MAX_WBITS
The default value of windowBits which is an argument for
Zlib::Deflate.new and Zlib::Inflate.new.
Zlib::NO_FLUSH
Zlib::SYNC_FLUSH
Zlib::FULL_FLUSH
Zlib::FINISH
The integers to control the output of the deflate stream, which are
an argument for Zlib::Deflate#deflate and so on.
Zlib::OS_CODE
Zlib::OS_MSDOS
Zlib::OS_AMIGA
Zlib::OS_VMS
Zlib::OS_UNIX
Zlib::OS_VMCMS
Zlib::OS_ATARI
Zlib::OS_OS2
Zlib::OS_MACOS
Zlib::OS_ZSYSTEM
Zlib::OS_CPM
Zlib::OS_TOPS20
Zlib::OS_WIN32
Zlib::OS_QDOS
Zlib::OS_RISCOS
Zlib::OS_UNKNOWN
The return values of Zlib::GzipFile#os_code method.
Calculates Alder-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.
/*
* call-seq: Zlib.adler32(string, adler)
*
* Calculates Alder-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(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
return do_checksum(argc, argv, adler32);
}
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.
/*
* call-seq: Zlib.crc32(string, adler)
*
* 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(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
return do_checksum(argc, argv, crc32);
}
Returns the table for calculating CRC checksum as an array.
/*
* Returns the table for calculating CRC checksum as an array.
*/
static VALUE
rb_zlib_crc_table(obj)
VALUE obj;
{
const unsigned long *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;
}