module Zlib

Constants

ASCII
BEST_COMPRESSION
BEST_SPEED
BINARY
DEFAULT_COMPRESSION
DEFAULT_STRATEGY
DEF_MEM_LEVEL
DeflateFuncs
FILTERED
FINISH
FULL_FLUSH
HUFFMAN_ONLY
InflateFuncs
LONG_MAX
LONG_MIN
MAX_MEM_LEVEL
MAX_WBITS
NO_COMPRESSION
NO_FLUSH
OS_AMIGA
OS_ATARI
OS_CODE
OS_MACOS
OS_MSDOS
OS_OS2
OS_TOPS20
OS_UNIX
OS_VMS
OS_WIN32
PR_ZLIB_VERSION
RUBY_ZLIB_VERSION
SYNC_FLUSH
UNKNOWN
VERSION
ZLIB_VERSION
ZSTREAM_AVAIL_OUT_STEP_MAX
ZSTREAM_AVAIL_OUT_STEP_MIN
ZSTREAM_FLAG_CLOSING
ZSTREAM_FLAG_FINISHED
ZSTREAM_FLAG_IN_STREAM
ZSTREAM_FLAG_READY
ZSTREAM_FLAG_UNUSED
ZSTREAM_INITIAL_BUFSIZE
ZStreamFuncs

Private Class Methods

check_long_range(num) click to toggle source
# File lib/pr/zlib.rb, line 1564
def self.check_long_range(num)
  # the error says 'unsigned', but this seems to be the range actually accepted
  raise RangeError, 'bignum too big to convert into `unsigned long\'' if num < LONG_MIN || num > LONG_MAX
end

Public Instance Methods

adler32(string=nil, adler=nil) click to toggle source
# File lib/pr/zlib.rb, line 1519
def adler32(string=nil, adler=nil)
  if adler
    check_long_range adler
    sum = adler
  elsif string.nil?
    sum = 0
  else
    sum = Rbzlib.adler32(0,nil)
  end

  if string.nil?
    sum = Rbzlib.adler32(sum,nil)
  else
    sum = Rbzlib.adler32(sum,string,string.length)
  end
  sum
end
crc32(string=nil, crc=nil) click to toggle source
# File lib/pr/zlib.rb, line 1537
def crc32(string=nil, crc=nil)
  if crc
    check_long_range crc
    sum = crc
  elsif string.nil?
    sum = 0
  else
    sum = Rbzlib.crc32(0,nil)
  end

  if string.nil?
    sum = Rbzlib.crc32(sum,nil)
  else
    sum = Rbzlib.crc32(sum,string,string.length)
  end
  sum
end
crc_table() click to toggle source
# File lib/pr/zlib.rb, line 1555
def crc_table
  get_crc_table
end
zlib_version() click to toggle source
# File lib/pr/zlib.rb, line 1515
def zlib_version
  zlibVersion()
end