<!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="Istring.html"> <link rel="next" href="Unzip.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="Utility" rel="Chapter" href="Utility.html"> <link title="Istring" rel="Chapter" href="Istring.html"> <link title="Io" rel="Chapter" href="Io.html"> <link title="Unzip" rel="Chapter" href="Unzip.html"> <link title="Pdfio" rel="Chapter" href="Pdfio.html"> <link title="Cgenlex" rel="Chapter" href="Cgenlex.html"> <link title="Zlib" rel="Chapter" href="Zlib.html"> <link title="Transform" rel="Chapter" href="Transform.html"> <link title="Units" rel="Chapter" href="Units.html"> <link title="Paper" rel="Chapter" href="Paper.html"> <link title="Pdf" rel="Chapter" href="Pdf.html"> <link title="Pdfcrypt" rel="Chapter" href="Pdfcrypt.html"> <link title="Pdfwrite" rel="Chapter" href="Pdfwrite.html"> <link title="Pdfcodec" rel="Chapter" href="Pdfcodec.html"> <link title="Pdfread" rel="Chapter" href="Pdfread.html"> <link title="Pdfpages" rel="Chapter" href="Pdfpages.html"> <link title="Pdfdoc" rel="Chapter" href="Pdfdoc.html"> <link title="Pdfannot" rel="Chapter" href="Pdfannot.html"> <link title="Pdffun" rel="Chapter" href="Pdffun.html"> <link title="Pdfspace" rel="Chapter" href="Pdfspace.html"> <link title="Pdfimage" rel="Chapter" href="Pdfimage.html"> <link title="Glyphlist" rel="Chapter" href="Glyphlist.html"> <link title="Pdftext" rel="Chapter" href="Pdftext.html"> <link title="Fonttables" rel="Chapter" href="Fonttables.html"> <link title="Pdfgraphics" rel="Chapter" href="Pdfgraphics.html"> <link title="Pdfshapes" rel="Chapter" href="Pdfshapes.html"> <link title="Pdfmarks" rel="Chapter" href="Pdfmarks.html"> <link title="Pdfdate" rel="Chapter" href="Pdfdate.html"> <link title="Cff" rel="Chapter" href="Cff.html"><link title="Binary files API" rel="Section" href="#6_BinaryfilesAPI"> <title>Io</title> </head> <body> <div class="navbar"><a class="pre" href="Istring.html" title="Istring">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="Unzip.html" title="Unzip">Next</a> </div> <h1>Module <a href="type_Io.html">Io</a></h1> <pre><span class="keyword">module</span> Io: <code class="code">sig</code> <a href="Io.html">..</a> <code class="code">end</code></pre><div class="info"> High-order abstract I/O. <p> IO module simply deals with abstract inputs/outputs. It provides a set of methods for working with these IO as well as several constructors that enable to write to an underlying channel, buffer, or enum.<br> </div> <hr width="100%"> <pre><span id="TYPEinput"><span class="keyword">type</span> <code class="type"></code>input</span> </pre> <div class="info"> The abstract input type.<br> </div> <pre><span id="EXCEPTIONNo_more_input"><span class="keyword">exception</span> No_more_input</span></pre> <div class="info"> This exception is raised when reading on an input with the <code class="code">read</code> or <code class="code">nread</code> functions while there is no available token to read.<br> </div> <pre><span id="EXCEPTIONInput_closed"><span class="keyword">exception</span> Input_closed</span></pre> <div class="info"> This exception is raised when reading on a closed input.<br> </div> <pre><span id="VALnread"><span class="keyword">val</span> nread</span> : <code class="type"><a href="Io.html#TYPEinput">input</a> -> int -> <a href="Istring.html#TYPEt">Istring.t</a></code></pre><div class="info"> <h6 id="6_StandardAPI">Standard API</h6> <p> <code class="code">nread i n</code> reads a string of size up to <code class="code">n</code> from an input. The function will raise <code class="code">No_more_input</code> if no input is available. It will raise <code class="code">Invalid_argument</code> if <code class="code">n</code> < 0.<br> </div> <pre><span id="VALclose_in"><span class="keyword">val</span> close_in</span> : <code class="type"><a href="Io.html#TYPEinput">input</a> -> unit</code></pre><div class="info"> Close the input. It can no longer be read from.<br> </div> <pre><span id="VALcreate_in"><span class="keyword">val</span> create_in</span> : <code class="type">(unit -> char) -><br> (<a href="Istring.html#TYPEt">Istring.t</a> -> int -> int -> int) -> (unit -> unit) -> <a href="Io.html#TYPEinput">input</a></code></pre><div class="info"> <h6 id="6_CreationofIOInputsOutputs">Creation of IO Inputs/Outputs</h6><br> </div> <br> Fully create an input by giving all the needed functions.<br> <pre><span id="VALread_all"><span class="keyword">val</span> read_all</span> : <code class="type"><a href="Io.html#TYPEinput">input</a> -> <a href="Istring.html#TYPEt">Istring.t</a></code></pre><div class="info"> <h6 id="6_Utilities">Utilities</h6> <p> read all the contents of the input until <code class="code">No_more_input</code> is raised.<br> </div> <br> <h6 id="6_BinaryfilesAPI">Binary files API</h6> <p> Here is some API useful for working with binary files, in particular binary files generated by C applications. By default, encoding of multibyte integers is low-endian. The BigEndian module provide multibyte operations with other encoding.<br> <pre><span id="EXCEPTIONOverflow"><span class="keyword">exception</span> Overflow</span> <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info"> Exception raised when a read or write operation cannot be completed.<br> </div> <pre><span id="VALread_byte"><span class="keyword">val</span> read_byte</span> : <code class="type"><a href="Io.html#TYPEinput">input</a> -> int</code></pre><div class="info"> Read an unsigned 8-bit integer.<br> </div> <pre><span id="VALread_ui16"><span class="keyword">val</span> read_ui16</span> : <code class="type"><a href="Io.html#TYPEinput">input</a> -> int</code></pre><div class="info"> Read an unsigned 16-bit word.<br> </div> </body></html>