<!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="Lwt_ssl.html"> <link rel="next" href="Lwt_term.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 attributes" rel=Appendix href="index_attributes.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 class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Lwt_condition" rel="Chapter" href="Lwt_condition.html"> <link title="Lwt_list" rel="Chapter" href="Lwt_list.html"> <link title="Lwt" rel="Chapter" href="Lwt.html"> <link title="Lwt_mutex" rel="Chapter" href="Lwt_mutex.html"> <link title="Lwt_mvar" rel="Chapter" href="Lwt_mvar.html"> <link title="Lwt_pool" rel="Chapter" href="Lwt_pool.html"> <link title="Lwt_sequence" rel="Chapter" href="Lwt_sequence.html"> <link title="Lwt_stream" rel="Chapter" href="Lwt_stream.html"> <link title="Lwt_switch" rel="Chapter" href="Lwt_switch.html"> <link title="Lwt_util" rel="Chapter" href="Lwt_util.html"> <link title="Lwt_pqueue" rel="Chapter" href="Lwt_pqueue.html"> <link title="Lwt_lib" rel="Chapter" href="Lwt_lib.html"> <link title="Lwt_glib" rel="Chapter" href="Lwt_glib.html"> <link title="Lwt_preemptive" rel="Chapter" href="Lwt_preemptive.html"> <link title="Lwt_event" rel="Chapter" href="Lwt_event.html"> <link title="Lwt_signal" rel="Chapter" href="Lwt_signal.html"> <link title="Lwt_react" rel="Chapter" href="Lwt_react.html"> <link title="Lwt_ssl" rel="Chapter" href="Lwt_ssl.html"> <link title="Lwt_text" rel="Chapter" href="Lwt_text.html"> <link title="Lwt_term" rel="Chapter" href="Lwt_term.html"> <link title="Lwt_read_line" rel="Chapter" href="Lwt_read_line.html"> <link title="Lwt_top" rel="Chapter" href="Lwt_top.html"> <link title="Lwt_chan" rel="Chapter" href="Lwt_chan.html"> <link title="Lwt_daemon" rel="Chapter" href="Lwt_daemon.html"> <link title="Lwt_gc" rel="Chapter" href="Lwt_gc.html"> <link title="Lwt_io" rel="Chapter" href="Lwt_io.html"> <link title="Lwt_log" rel="Chapter" href="Lwt_log.html"> <link title="Lwt_main" rel="Chapter" href="Lwt_main.html"> <link title="Lwt_process" rel="Chapter" href="Lwt_process.html"> <link title="Lwt_throttle" rel="Chapter" href="Lwt_throttle.html"> <link title="Lwt_timeout" rel="Chapter" href="Lwt_timeout.html"> <link title="Lwt_unix" rel="Chapter" href="Lwt_unix.html"> <link title="Lwt_sys" rel="Chapter" href="Lwt_sys.html"> <link title="Lwt_engine" rel="Chapter" href="Lwt_engine.html"> <link title="Lwt_bytes" rel="Chapter" href="Lwt_bytes.html"> <link title="Pa_lwt" rel="Chapter" href="Pa_lwt.html"> <link title="Pa_lwt_log" rel="Chapter" href="Pa_lwt_log.html"><link title="Types" rel="Section" href="#6_Types"> <link title="Creation/manipulation" rel="Section" href="#6_Creationmanipulation"> <link title="Lwt_io like values" rel="Section" href="#6_Lwtiolikevalues"> <title>Lwt_text</title> </head> <body> <div class="navbar"><a class="pre" href="Lwt_ssl.html" title="Lwt_ssl">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="Lwt_term.html" title="Lwt_term">Next</a> </div> <h1>Module <a href="type_Lwt_text.html">Lwt_text</a></h1> <pre><span class="keyword">module</span> Lwt_text: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_text.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info"> Text channels<br> </div> <hr width="100%"> <br> This modules implements <b>text channel</b>s. A <b>text channel</b> is basically a <b>byte channel</b> (as in <a href="Lwt_io.html"><code class="code"><span class="constructor">Lwt_io</span></code></a>) plus a <b>character encoding</b>. <p> It has almost the same interface as <a href="Lwt_io.html"><code class="code"><span class="constructor">Lwt_io</span></code></a> except that it uses <code class="code"><span class="constructor">Text</span>.t</code> in place of <code class="code">string</code> and <code class="code">char</code><br> <br> <h6 id="6_Types">Types</h6><br> <pre><span id="TYPEchannel"><span class="keyword">type</span> <code class="type">'mode</code> channel</span> </pre> <div class="info"> Type of a text channel<br> </div> <pre><span id="TYPEinput_channel"><span class="keyword">type</span> <code class="type"></code>input_channel</span> = <code class="type"><a href="Lwt_io.html#TYPEinput">Lwt_io.input</a> <a href="Lwt_text.html#TYPEchannel">channel</a></code> </pre> <div class="info"> Type of a text input channel<br> </div> <pre><span id="TYPEoutput_channel"><span class="keyword">type</span> <code class="type"></code>output_channel</span> = <code class="type"><a href="Lwt_io.html#TYPEoutput">Lwt_io.output</a> <a href="Lwt_text.html#TYPEchannel">channel</a></code> </pre> <div class="info"> Type of a text output channel<br> </div> <br> <h6 id="6_Creationmanipulation">Creation/manipulation</h6><br> <pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">?strict:bool -><br> ?encoding:Encoding.t -> 'a <a href="Lwt_io.html#TYPEchannel">Lwt_io.channel</a> -> 'a <a href="Lwt_text.html#TYPEchannel">channel</a></code></pre><div class="info"> <code class="code">make ?strict ?encoding ch</code> creates a text channel from a byte channel.<br> </div> <div class="param_info"><code class="code">strict</code> : tell whether encoding/decoding must be ``strict'', which whether the encoder/decoder should fail on invalid sequence. In non-strict mode, it transparently fallback to ISO-8859-15. By the way it is ensured that <code class="code">read*</code> functions always returns valid UTF-8 encoded text. <code class="code">strict</code> defaults to <code class="code"><span class="keyword">false</span></code>.</div> <div class="param_info"><code class="code">encoding</code> : is the character encoding used for the channel. It defaults to <code class="code"><span class="constructor">Encoding</span>.system</code>.</div> <pre><span id="VALbyte_channel"><span class="keyword">val</span> byte_channel</span> : <code class="type">'a <a href="Lwt_text.html#TYPEchannel">channel</a> -> 'a <a href="Lwt_io.html#TYPEchannel">Lwt_io.channel</a></code></pre><div class="info"> <code class="code">byte_channel ch</code> returns the underlying byte channel of a text channel<br> </div> <pre><span id="VALencoding"><span class="keyword">val</span> encoding</span> : <code class="type">'a <a href="Lwt_text.html#TYPEchannel">channel</a> -> Encoding.t</code></pre><div class="info"> <code class="code">encoding ch</code> returns the character encoding of a channel.<br> </div> <pre><span id="VALflush"><span class="keyword">val</span> flush</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info"> Flush the underlying byte channel<br> </div> <pre><span id="VALclose"><span class="keyword">val</span> close</span> : <code class="type">'a <a href="Lwt_text.html#TYPEchannel">channel</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info"> Close the underlying byte channel<br> </div> <br> <h6 id="6_Lwtiolikevalues">Lwt_io like values</h6><br> <pre><span id="VALatomic"><span class="keyword">val</span> atomic</span> : <code class="type">('a <a href="Lwt_text.html#TYPEchannel">channel</a> -> 'b <a href="Lwt.html#TYPEt">Lwt.t</a>) -> 'a <a href="Lwt_text.html#TYPEchannel">channel</a> -> 'b <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALstdin"><span class="keyword">val</span> stdin</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a></code></pre><pre><span id="VALstdout"><span class="keyword">val</span> stdout</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a></code></pre><pre><span id="VALstderr"><span class="keyword">val</span> stderr</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a></code></pre><pre><span id="VALzero"><span class="keyword">val</span> zero</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a></code></pre><pre><span id="VALnull"><span class="keyword">val</span> null</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a></code></pre><pre><span id="VALread_char"><span class="keyword">val</span> read_char</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALread_char_opt"><span class="keyword">val</span> read_char_opt</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t option <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALread_chars"><span class="keyword">val</span> read_chars</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a></code></pre><pre><span id="VALread_line"><span class="keyword">val</span> read_line</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALread_line_opt"><span class="keyword">val</span> read_line_opt</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t option <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALread_lines"><span class="keyword">val</span> read_lines</span> : <code class="type"><a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a></code></pre><pre><span id="VALread"><span class="keyword">val</span> read</span> : <code class="type">?count:int -> <a href="Lwt_text.html#TYPEinput_channel">input_channel</a> -> Text.t <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwrite_char"><span class="keyword">val</span> write_char</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwrite_chars"><span class="keyword">val</span> write_chars</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwrite"><span class="keyword">val</span> write</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwrite_line"><span class="keyword">val</span> write_line</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwrite_lines"><span class="keyword">val</span> write_lines</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALopen_file"><span class="keyword">val</span> open_file</span> : <code class="type">?buffer_size:int -><br> ?strict:bool -><br> ?encoding:Encoding.t -><br> ?flags:Unix.open_flag list -><br> ?perm:Unix.file_perm -><br> mode:'a <a href="Lwt_io.html#TYPEmode">Lwt_io.mode</a> -> <a href="Lwt_io.html#TYPEfile_name">Lwt_io.file_name</a> -> 'a <a href="Lwt_text.html#TYPEchannel">channel</a> <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwith_file"><span class="keyword">val</span> with_file</span> : <code class="type">?buffer_size:int -><br> ?strict:bool -><br> ?encoding:Encoding.t -><br> ?flags:Unix.open_flag list -><br> ?perm:Unix.file_perm -><br> mode:'a <a href="Lwt_io.html#TYPEmode">Lwt_io.mode</a> -><br> <a href="Lwt_io.html#TYPEfile_name">Lwt_io.file_name</a> -> ('a <a href="Lwt_text.html#TYPEchannel">channel</a> -> 'b <a href="Lwt.html#TYPEt">Lwt.t</a>) -> 'b <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALlines_of_file"><span class="keyword">val</span> lines_of_file</span> : <code class="type"><a href="Lwt_io.html#TYPEfile_name">Lwt_io.file_name</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a></code></pre><pre><span id="VALlines_to_file"><span class="keyword">val</span> lines_to_file</span> : <code class="type"><a href="Lwt_io.html#TYPEfile_name">Lwt_io.file_name</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALchars_of_file"><span class="keyword">val</span> chars_of_file</span> : <code class="type"><a href="Lwt_io.html#TYPEfile_name">Lwt_io.file_name</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a></code></pre><pre><span id="VALchars_to_file"><span class="keyword">val</span> chars_to_file</span> : <code class="type"><a href="Lwt_io.html#TYPEfile_name">Lwt_io.file_name</a> -> Text.t <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALfprint"><span class="keyword">val</span> fprint</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALfprintl"><span class="keyword">val</span> fprintl</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALfprintf"><span class="keyword">val</span> fprintf</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -><br> ('a, unit, Text.t, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALfprintlf"><span class="keyword">val</span> fprintlf</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -><br> ('a, unit, Text.t, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALprintl"><span class="keyword">val</span> printl</span> : <code class="type">Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALprintf"><span class="keyword">val</span> printf</span> : <code class="type">('a, unit, Text.t, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALprintlf"><span class="keyword">val</span> printlf</span> : <code class="type">('a, unit, Text.t, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALeprint"><span class="keyword">val</span> eprint</span> : <code class="type">Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALeprintl"><span class="keyword">val</span> eprintl</span> : <code class="type">Text.t -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALeprintf"><span class="keyword">val</span> eprintf</span> : <code class="type">('a, unit, Text.t, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALeprintlf"><span class="keyword">val</span> eprintlf</span> : <code class="type">('a, unit, Text.t, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALhexdump_stream"><span class="keyword">val</span> hexdump_stream</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> char <a href="Lwt_stream.html#TYPEt">Lwt_stream.t</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALhexdump"><span class="keyword">val</span> hexdump</span> : <code class="type"><a href="Lwt_text.html#TYPEoutput_channel">output_channel</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre></body></html>