<!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="previous" href="Bi_io.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="Bi_util" rel="Chapter" href="Bi_util.html"> <link title="Bi_share" rel="Chapter" href="Bi_share.html"> <link title="Bi_outbuf" rel="Chapter" href="Bi_outbuf.html"> <link title="Bi_inbuf" rel="Chapter" href="Bi_inbuf.html"> <link title="Bi_vint" rel="Chapter" href="Bi_vint.html"> <link title="Bi_io" rel="Chapter" href="Bi_io.html"> <link title="Bi_stream" rel="Chapter" href="Bi_stream.html"><title>Bi_stream</title> </head> <body> <div class="navbar"><a class="pre" href="Bi_io.html" title="Bi_io">Previous</a> <a class="up" href="index.html" title="Index">Up</a> </div> <h1>Module <a href="type_Bi_stream.html">Bi_stream</a></h1> <pre><span class="keyword">module</span> Bi_stream: <code class="code">sig</code> <a href="Bi_stream.html">..</a> <code class="code">end</code></pre><div class="info module top"> Streaming utilities (experimental)<br> </div> <hr width="100%"> <br> This module offers a streaming interface for representing long lists of elements that cannot fit in memory. Stream items are serialized as chunks of configurable length. <p> Stream format (independent from the biniou serialization format): <p> <pre class="verbatim"> ( ONE INT64 BYTE* )* ZERO</pre> <p> where <code class="code">INT64</code> is the length of a chunk (unsigned big-endian 64-bit int), i.e. the number of following <code class="code">BYTE</code>s. <code class="code">ONE</code> and <code class="code">ZERO</code> are the single-byte representations of 1 and 0 and are used to indicate whether the end of the stream is reached.<br> <pre><span id="VALread_stream"><span class="keyword">val</span> read_stream</span> : <code class="type">(string -> 'a array) -> Pervasives.in_channel -> 'a Stream.t</code></pre><div class="info "> <code class="code">read_stream of_string ic</code> creates an OCaml stream from an input channel <code class="code">ic</code>. The data come in chunks and each chunk is converted from a string to an array by calling <code class="code">of_string</code>.<br> </div> <pre><span id="VALwrite_stream"><span class="keyword">val</span> write_stream</span> : <code class="type">?chunk_len:int -><br> ('a array -> string) -> Pervasives.out_channel -> 'a Stream.t -> unit</code></pre><div class="info "> <code class="code">write_stream to_string oc st</code> writes an OCaml stream to the output channel <code class="code">oc</code>. It creates chunks of <code class="code">chunk_len</code>, except for the last chunk which is usually smaller.<br> </div> <div class="param_info"><code class="code">chunk_len</code> : has a default value of 1024. The limit supported by this OCaml implementation on 32-bit platforms is 16777215.</div> </body></html>