package comby
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ee6556d8bd9b25ed0445ebe23862e48a
sha512=e6386c8ce5ef14bbcab2b0ead5b1edc39375438f56330d5f02e81e467afe6623a7e299f97f26008d77bbc62850c6dc63a7cbe5b81671b5183ff3adeee5946bb3
doc/comby.camlzip/Camlzip/Gzip/index.html
Module Camlzip.Gzip
Source
Reading and writing to/from gzip
compressed files
This module provides functions to read and write compressed data to/from files in gzip
format.
Reading from compressed files
Abstract type representing a channel opened for reading from a compressed file.
Abstract type representing a channel opened for reading from a compressed file.
Open a compressed file for reading. The argument is the file name.
Open a compressed file for reading. The argument is the file name.
Open a compressed file for reading. The argument is a regular file channel already opened on the compressed file.
Open a compressed file for reading. The argument is a regular file channel already opened on the compressed file.
Uncompress one character from the given channel, and return it. Raise End_of_file
if no more compressed data is available.
Uncompress one character from the given channel, and return it. Raise End_of_file
if no more compressed data is available.
Same as Gzip.input_char
, but return the 8-bit integer representing the character. Raise End_of_file
if no more compressed data is available.
Same as Gzip.input_char
, but return the 8-bit integer representing the character. Raise End_of_file
if no more compressed data is available.
input 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
.
input 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
.
really_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
.
really_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
.
Close the given input channel. If the channel was created with Gzip.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.
Close the given input channel. If the channel was created with Gzip.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.
Same as Gzip.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.
Writing to compressed files
Abstract type representing a channel opened for writing to a compressed file.
Abstract type representing a channel opened for writing to a compressed file.
Open a compressed file for writing. The argument is the file name. The file is created if it does not exist, or truncated to zero length if it exists. The optional level
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).
Open a compressed file for writing. The argument is the file name. The file is created if it does not exist, or truncated to zero length if it exists. The optional level
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).
Open a compressed file for writing. The argument is a regular file channel already opened on the compressed file. The optional level
argument sets the compression level as documented for Gzip.open_out
.
Open a compressed file for writing. The argument is a regular file channel already opened on the compressed file. The optional level
argument sets the compression level as documented for Gzip.open_out
.
Output one character to the given compressed channel.
Output one character to the given compressed channel.
Same as Gzip.output_char
, but the output character is given by its code. The given integer is taken modulo 256.
Same as Gzip.output_char
, but the output character is given by its code. The given integer is taken modulo 256.
output 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
.
output 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
.
Same as output
, but takes a string as argument instead of a byte sequence.
Same as output
, but takes a string as argument instead of a byte sequence.
Close the given output channel. If the channel was created with Gzip.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.
Close the given output channel. If the channel was created with Gzip.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.
Same as Gzip.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.
Same as Gzip.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.
Flush all pending compressed data through both the compression channel and the underlying regular file channel, but keep both channels open to accept further data.
Error reporting
Exception raised by the functions above to signal errors during compression or decompression, or ill-formed input files.