<!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="BitSet.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 class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Base64" rel="Chapter" href="Base64.html"> <link title="BitSet" rel="Chapter" href="BitSet.html"> <link title="Dllist" rel="Chapter" href="Dllist.html"> <link title="DynArray" rel="Chapter" href="DynArray.html"> <link title="Enum" rel="Chapter" href="Enum.html"> <link title="ExtArray" rel="Chapter" href="ExtArray.html"> <link title="ExtHashtbl" rel="Chapter" href="ExtHashtbl.html"> <link title="ExtList" rel="Chapter" href="ExtList.html"> <link title="ExtString" rel="Chapter" href="ExtString.html"> <link title="Global" rel="Chapter" href="Global.html"> <link title="IO" rel="Chapter" href="IO.html"> <link title="OptParse" rel="Chapter" href="OptParse.html"> <link title="Option" rel="Chapter" href="Option.html"> <link title="PMap" rel="Chapter" href="PMap.html"> <link title="RefList" rel="Chapter" href="RefList.html"> <link title="Std" rel="Chapter" href="Std.html"> <link title="UChar" rel="Chapter" href="UChar.html"> <link title="UTF8" rel="Chapter" href="UTF8.html"> <link title="Unzip" rel="Chapter" href="Unzip.html"><title>Base64</title> </head> <body> <div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="BitSet.html" title="BitSet">Next</a> </div> <h1>Module <a href="type_Base64.html">Base64</a></h1> <pre><span class="keyword">module</span> Base64: <code class="code">sig</code> <a href="Base64.html">..</a> <code class="code">end</code></pre><div class="info"> Base64 codec. <p> 8-bit characters are encoded into 6-bit ones using ASCII lookup tables. Default tables maps 0..63 values on characters A-Z, a-z, 0-9, '+' and '/' (in that order).<br> </div> <hr width="100%"> <pre><span id="EXCEPTIONInvalid_char"><span class="keyword">exception</span> Invalid_char</span></pre> <div class="info"> This exception is raised when reading an invalid character from a base64 input.<br> </div> <pre><span id="EXCEPTIONInvalid_table"><span class="keyword">exception</span> Invalid_table</span></pre> <div class="info"> This exception is raised if the encoding or decoding table size is not correct.<br> </div> <pre><span id="TYPEencoding_table"><span class="keyword">type</span> <code class="type"></code>encoding_table</span> = <code class="type">char array</code> </pre> <div class="info"> An encoding table maps integers 0..63 to the corresponding char.<br> </div> <pre><span id="TYPEdecoding_table"><span class="keyword">type</span> <code class="type"></code>decoding_table</span> = <code class="type">int array</code> </pre> <div class="info"> A decoding table mais chars 0..255 to the corresponding 0..63 value or -1 if the char is not accepted.<br> </div> <pre><span id="VALstr_encode"><span class="keyword">val</span> str_encode</span> : <code class="type">?tbl:<a href="Base64.html#TYPEencoding_table">encoding_table</a> -> string -> string</code></pre><div class="info"> Encode a string into Base64.<br> </div> <pre><span id="VALstr_decode"><span class="keyword">val</span> str_decode</span> : <code class="type">?tbl:<a href="Base64.html#TYPEdecoding_table">decoding_table</a> -> string -> string</code></pre><div class="info"> Decode a string encoded into Base64, raise <code class="code">Invalid_char</code> if a character in the input string is not a valid one.<br> </div> <pre><span id="VALencode"><span class="keyword">val</span> encode</span> : <code class="type">?tbl:<a href="Base64.html#TYPEencoding_table">encoding_table</a> -> 'a <a href="IO.html#TYPEoutput">IO.output</a> -> 'a <a href="IO.html#TYPEoutput">IO.output</a></code></pre><div class="info"> Generic base64 encoding over an output.<br> </div> <pre><span id="VALdecode"><span class="keyword">val</span> decode</span> : <code class="type">?tbl:<a href="Base64.html#TYPEdecoding_table">decoding_table</a> -> <a href="IO.html#TYPEinput">IO.input</a> -> <a href="IO.html#TYPEinput">IO.input</a></code></pre><div class="info"> Generic base64 decoding over an input.<br> </div> <pre><span id="VALmake_decoding_table"><span class="keyword">val</span> make_decoding_table</span> : <code class="type"><a href="Base64.html#TYPEencoding_table">encoding_table</a> -> <a href="Base64.html#TYPEdecoding_table">decoding_table</a></code></pre><div class="info"> Create a valid decoding table from an encoding one.<br> </div> </body></html>