type in_channel
type out_channel
exception Error of string
val version : string
open_out opens the given filename for writing. The optional
compression argument specifies the level of compression : 0 is
no compression, 1 is fastest , 9 is best but slowest. The default is a
compromise (6, I think). Refer to the zlib manual (i.e the
header file zlib.h) for an explanation of the zstrategy
argument. setparams allows to modify these two parameters after
the channel has been opened.
type zstrategy = | Default | Filtered | Huffman_only
val open_out : ?compression:int -> ?strategy:zstrategy -> string -> out_channel
external setparams : out_channel -> compression:int -> strategy:zstrategy -> unit = "wrap_gzsetparams"
These functions output substrings, strings, char or char value (int
argument). The external ones use the zlib functions, the usual Caml
ones are only wrappers around those. output_string and write will
correctly handle null characters embedded in Caml strings. output_value
uses the Marshal module.
external write : out_channel -> buf:string -> pos:int -> len:int -> unit = "wrap_gzwrite"
external output_string : out_channel -> string -> unit = "wrap_gzputs"
external output_char : out_channel -> char -> unit = "wrap_gzputc"
external output_byte : out_channel -> int -> unit = "wrap_gzputc"
val output_newline : out_channel -> unit
val output_endline : out_channel -> string -> unit
val output_value : out_channel -> 'a -> unit
The flush function should be used with caution because it can
degrade compression. The optional flush argument defaults to
Sync_flush.
type flush = | Sync_flush | Full_flush | Finish_flush
val flush : ?flush:flush -> out_channel -> unit
seek_out set the position of the next write operation on the
channel. Only forward seeks are supported; seek_out then compresses
a sequence of zeroes up to the new starting position. It raises
Invalid_argument if called with a negative offset.
val seek_out : out_channel -> offset:int -> unit
val pos_out : out_channel -> int
close_out flushes all pending output if necessary, closes the
compressed file and deallocates all the (de)compression state. Any
subsequent use of the channel will raise an Error exception.
external close_out : out_channel -> unit = "wrap_gzclose"
val open_in : string -> in_channel
read reads characters from the stream and returns the number of bytes
actually read ; it does not raise End_of_file. input_char and
input_line should appropriately raise End_of_file if necessary.
input_value uses module Marshal.
external read : in_channel -> buf:string -> pos:int -> len:int -> int = "wrap_gzread"
external input_char : in_channel -> char = "wrap_gzgetc"
val input_line : in_channel -> string
val input_value : in_channel -> 'a
The seek_in function is emulated but can be extremely slow.
external rewind : in_channel -> unit = "wrap_gzrewind"
val seek_in : in_channel -> offset:int -> unit
val pos_in : in_channel -> int
external close_in : in_channel -> unit = "wrap_gzclose"
Go to the first, previous, next, last section, table of contents.