module Gzip:sig..end
gzip compressed files
This module provides functions to read and write compressed data
to/from files in gzip format.
type in_channel
val open_in : string -> in_channelval open_in_chan : Pervasives.in_channel -> in_channelval input_char : in_channel -> charEnd_of_file if no more compressed data is available.val input_byte : in_channel -> intGzip.input_char, but return the 8-bit integer
representing the character.
Raise End_of_file if no more compressed data is available.val input : in_channel -> string -> int -> int -> intinput ic buf pos len uncompresses up to len characters
from the given channel ic,
storing them in string buf, starting at character number pos.
It returns the actual number of characters read, between 0 and
len (inclusive).
A return value of 0 means that the end of file was reached.
A return value between 0 and len exclusive means that
not all requested len characters were read, either because
no more characters were available at that time, or because
the implementation found it convenient to do a partial read;
input must be called again to read the remaining characters,
if desired. (See also Gzip.really_input for reading
exactly len characters.)
Exception Invalid_argument "Gzip.input" is raised if
pos and len do not designate a valid substring of buf.val really_input : in_channel -> string -> int -> int -> unitreally_input ic buf pos len uncompresses len characters
from the given channel, storing them in
string buf, starting at character number pos.
Raise End_of_file if fewer than len characters can be read.
Raise Invalid_argument "Gzip.input" if
pos and len do not designate a valid substring of buf.val close_in : in_channel -> unitGzip.open_in_chan, the underlying regular file channel
(of type Pervasives.in_channel) is also closed.
Do not apply any of the functions above to a closed channel.val dispose : in_channel -> unitGzip.close_in, but does not close the underlying
regular file channel (of type Pervasives.in_channel);
just dispose of the resources associated with the decompression
channel. This can be useful if e.g. the underlying file channel
is a network socket on which more (uncompressed) data
is expected.type out_channel
val open_out : ?level:int -> string -> out_channellevel argument (an integer between 1 and 9)
indicates the compression level, with 1 being the weakest
(but fastest) compression and 9 being the strongest
(but slowest) compression. The default level is 6
(medium compression).val open_out_chan : ?level:int -> Pervasives.out_channel -> out_channellevel argument sets the compression level
as documented for Gzip.open_out.val output_char : out_channel -> char -> unitval output_byte : out_channel -> int -> unitGzip.output_char, but the output character is given
by its code. The given integer is taken modulo 256.val output : out_channel -> string -> int -> int -> unitoutput oc buf pos len compresses and writes len characters
from string buf, starting at offset pos, and writes the
compressed data to the channel oc.
Raise Invalid_argument "Gzip.output" if
pos and len do not designate a valid substring of buf.val close_out : out_channel -> unitGzip.open_out_chan, the underlying regular file channel
(of type Pervasives.out_channel) is also closed.
Do not apply any of the functions above to a closed channel.val flush : out_channel -> unitGzip.close_out, but do not close the underlying
regular file channel (of type Pervasives.out_channel);
just flush all pending compressed data and
dispose of the resources associated with the compression
channel. This can be useful if e.g. the underlying file channel
is a network socket on which more data is to be sent.exception Error of string