Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > af2bae5736929bb68972421f6d5ee862 > files > 12

ocaml-camlzip-devel-1.04-7mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="next" href="Zip.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Gzip" rel="Chapter" href="Gzip.html">
<link title="Zip" rel="Chapter" href="Zip.html">
<link title="Zlib" rel="Chapter" href="Zlib.html"><link title="Reading from compressed files" rel="Section" href="#6_Readingfromcompressedfiles">
<link title="Writing to compressed files" rel="Section" href="#6_Writingtocompressedfiles">
<link title="Error reporting" rel="Section" href="#6_Errorreporting">
<title>Gzip</title>
</head>
<body>
<div class="navbar">&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Zip.html">Next</a>
</div>
<center><h1>Module <a href="type_Gzip.html">Gzip</a></h1></center>
<br>
<pre><span class="keyword">module</span> Gzip: <code class="code"><span class="keyword">sig</span></code> <a href="Gzip.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>Reading and writing to/from <code class="code">gzip</code> compressed files
<p>

   This module provides functions to read and write compressed data
   to/from files in <code class="code">gzip</code> format.<br>
<hr width="100%">
<br>
<a name="6_Readingfromcompressedfiles"></a>
<h6>Reading from compressed files</h6><br>
<pre><span class="keyword">type</span> <a name="TYPEin_channel"></a><code class="type"></code>in_channel </pre>
<div class="info">
Abstract type representing a channel opened for reading
           from a compressed file.<br>
</div>

<pre><span class="keyword">val</span> <a name="VALopen_in"></a>open_in : <code class="type">string -> <a href="Gzip.html#TYPEin_channel">in_channel</a></code></pre><div class="info">
Open a compressed file for reading.  The argument is the file
           name.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALopen_in_chan"></a>open_in_chan : <code class="type">Pervasives.in_channel -> <a href="Gzip.html#TYPEin_channel">in_channel</a></code></pre><div class="info">
Open a compressed file for reading.  The argument is a
           regular file channel already opened on the compressed file.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALinput_char"></a>input_char : <code class="type"><a href="Gzip.html#TYPEin_channel">in_channel</a> -> char</code></pre><div class="info">
Uncompress one character from the given channel, and return it.
           Raise <code class="code"><span class="constructor">End_of_file</span></code> if no more compressed data is available.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALinput_byte"></a>input_byte : <code class="type"><a href="Gzip.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info">
Same as <code class="code"><span class="constructor">Gzip</span>.input_char</code>, but return the 8-bit integer
           representing the character.
           Raise <code class="code"><span class="constructor">End_of_file</span></code> if no more compressed data is available.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALinput"></a>input : <code class="type"><a href="Gzip.html#TYPEin_channel">in_channel</a> -> string -> int -> int -> int</code></pre><div class="info">
<code class="code">input ic buf pos len</code> uncompresses up to <code class="code">len</code> characters
           from the given channel <code class="code">ic</code>,
           storing them in string <code class="code">buf</code>, starting at character number <code class="code">pos</code>.
           It returns the actual number of characters read, between 0 and
           <code class="code">len</code> (inclusive).
           A return value of 0 means that the end of file was reached.
           A return value between 0 and <code class="code">len</code> exclusive means that
           not all requested <code class="code">len</code> 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;
           <code class="code">input</code> must be called again to read the remaining characters,
           if desired.  (See also <code class="code"><span class="constructor">Gzip</span>.really_input</code> for reading
           exactly <code class="code">len</code> characters.)
           Exception <code class="code"><span class="constructor">Invalid_argument</span> <span class="string">"Gzip.input"</span></code> is raised if
           <code class="code">pos</code> and <code class="code">len</code> do not designate a valid substring of <code class="code">buf</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALreally_input"></a>really_input : <code class="type"><a href="Gzip.html#TYPEin_channel">in_channel</a> -> string -> int -> int -> unit</code></pre><div class="info">
<code class="code">really_input ic buf pos len</code> uncompresses <code class="code">len</code> characters
           from the given channel, storing them in
           string <code class="code">buf</code>, starting at character number <code class="code">pos</code>.
           Raise <code class="code"><span class="constructor">End_of_file</span></code> if fewer than <code class="code">len</code> characters can be read.
           Raise <code class="code"><span class="constructor">Invalid_argument</span> <span class="string">"Gzip.input"</span></code> if
           <code class="code">pos</code> and <code class="code">len</code> do not designate a valid substring of <code class="code">buf</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALclose_in"></a>close_in : <code class="type"><a href="Gzip.html#TYPEin_channel">in_channel</a> -> unit</code></pre><div class="info">
Close the given input channel.  If the channel was created with
           <code class="code"><span class="constructor">Gzip</span>.open_in_chan</code>, the underlying regular file channel
           (of type <code class="code"><span class="constructor">Pervasives</span>.in_channel</code>) is also closed.
           Do not apply any of the functions above to a closed channel.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdispose"></a>dispose : <code class="type"><a href="Gzip.html#TYPEin_channel">in_channel</a> -> unit</code></pre><div class="info">
Same as <code class="code"><span class="constructor">Gzip</span>.close_in</code>, but does not close the underlying
           regular file channel (of type <code class="code"><span class="constructor">Pervasives</span>.in_channel</code>);
           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.<br>
</div>
<br>
<a name="6_Writingtocompressedfiles"></a>
<h6>Writing to compressed files</h6><br>
<pre><span class="keyword">type</span> <a name="TYPEout_channel"></a><code class="type"></code>out_channel </pre>
<div class="info">
Abstract type representing a channel opened for writing
           to a compressed file.<br>
</div>

<pre><span class="keyword">val</span> <a name="VALopen_out"></a>open_out : <code class="type">?level:int -> string -> <a href="Gzip.html#TYPEout_channel">out_channel</a></code></pre><div class="info">
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 <code class="code">level</code> 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).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALopen_out_chan"></a>open_out_chan : <code class="type">?level:int -> Pervasives.out_channel -> <a href="Gzip.html#TYPEout_channel">out_channel</a></code></pre><div class="info">
Open a compressed file for writing.  The argument is a
           regular file channel already opened on the compressed file.
           The optional <code class="code">level</code> argument sets the compression level
           as documented for <code class="code"><span class="constructor">Gzip</span>.open_out</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALoutput_char"></a>output_char : <code class="type"><a href="Gzip.html#TYPEout_channel">out_channel</a> -> char -> unit</code></pre><div class="info">
Output one character to the given compressed channel.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALoutput_byte"></a>output_byte : <code class="type"><a href="Gzip.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info">
Same as <code class="code"><span class="constructor">Gzip</span>.output_char</code>, but the output character is given
           by its code.  The given integer is taken modulo 256.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALoutput"></a>output : <code class="type"><a href="Gzip.html#TYPEout_channel">out_channel</a> -> string -> int -> int -> unit</code></pre><div class="info">
<code class="code">output oc buf pos len</code> compresses and writes <code class="code">len</code> characters
           from string <code class="code">buf</code>, starting at offset <code class="code">pos</code>, and writes the
           compressed data to the channel <code class="code">oc</code>.
           Raise <code class="code"><span class="constructor">Invalid_argument</span> <span class="string">"Gzip.output"</span></code> if
           <code class="code">pos</code> and <code class="code">len</code> do not designate a valid substring of <code class="code">buf</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALclose_out"></a>close_out : <code class="type"><a href="Gzip.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info">
Close the given output channel.  If the channel was created with
           <code class="code"><span class="constructor">Gzip</span>.open_out_chan</code>, the underlying regular file channel
           (of type <code class="code"><span class="constructor">Pervasives</span>.out_channel</code>) is also closed.
           Do not apply any of the functions above to a closed channel.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALflush"></a>flush : <code class="type"><a href="Gzip.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info">
Same as <code class="code"><span class="constructor">Gzip</span>.close_out</code>, but do not close the underlying
           regular file channel (of type <code class="code"><span class="constructor">Pervasives</span>.out_channel</code>);
           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.<br>
</div>
<br>
<a name="6_Errorreporting"></a>
<h6>Error reporting</h6><br>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONError"></a>Error <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
Exception raised by the functions above to signal errors during
           compression or decompression, or ill-formed input files.<br>
</div>
</body></html>