Zlib v1.0.0 documentation

Documentation generated by XL CLAIRE v3.3.37 at Fri, 17 Nov 2006

Category index

  1. Compression filters

Method index


Zlib categories


categories
Compression filters

Compression filters

This module implements compression algorithm as decribed by RFC 1951 (deflate format) and RFC 1950 (gzip format). This module relies on the popular zlib library. This implementation defines two kind of filter :

 Zlib/deflater <: filter
 Zlib/gziper <: Zlib/deflater
 
That are respectively instanciated by deflater! @ port and gziper! @ port. As an exemple we could write a fopen like method that handles compressed files :

 gzopen(f:stringmode:{"r""w"}) : gziper ->
     let f := fopen(fmode)
     in close_target!(Zlib/gziper!(f))
 
Then we would write a compression method that take the name of an input file and the name of a target compressed file as follow :

 compress_file(fin:stringfout:string: void ->
     let f := fopen(fin"r"),
         gz := gzopen(fout"w")
     in (freadwrite(fgz),
         fclose(f),
         fclose(gz))
 


Zlib methods


categories Compression filters normal dispatch Zlib method

Zlib/deflater!(self:port) -> deflater

deflater!(self) is equivalent to deflater!(self, 6)


categories Compression filters normal dispatch Zlib method

Zlib/deflater!(self:port, compression_level:0 .. 9) -> deflater

deflater!(self, compression_level) creates a new deflate filter on the port self. compression_level is an integer in the range (0 .. 9) and drives the compression strategy :


categories Compression filters normal dispatch Zlib method

Zlib/gziper!(self:port) -> gziper

gziper!(self) is equivalent to gziper!(self, 6).


categories Compression filters normal dispatch Zlib method

Zlib/gziper!(self:port, compression_level:0 .. 9) -> gziper

gziper!(self, compression_level) is similar to deflater!(self, compression_level) concerning the compression algorithm (gziper derive from deflater) but also adds a gzip specific header to the head of the compressed stream and a CRC check sum to the tail of stream (at close time).


categories Compression filters normal dispatch Zlib method

Zlib/zlibversion() -> string

zlibversion() return the version of the underlying zlib library.