<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>13.2. Input/Output model</title><link rel="stylesheet" type="text/css" href="ecl.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="ch13.html" title="Chapter 13. Streams"><link rel="prev" href="ch13.html" title="Chapter 13. Streams"><link rel="next" href="ch14.html" title="Chapter 14. Printer"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">13.2. Input/Output model</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch13.html">Prev</a> </td><th width="60%" align="center">Chapter 13. Streams</th><td width="20%" align="right"> <a accesskey="n" href="ch14.html">Next</a></td></tr></table><hr></div><div class="section" title="13.2. Input/Output model"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.ansi.streams.io"></a>13.2. Input/Output model</h2></div></div></div><p><span class="application">ECL</span> distinguishes between two kinds of streams: character streams and byte streams. In the first kind one is only allowed to write characters, either individually, with <code class="function">write-char</code>, or in chunks, with <code class="function">write-sequence</code> or any of the Lisp printer functions. The implementation of character streams in <span class="application">ECL</span> has the following shortcomings: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>No support for external formats. Reading and writing is performed using the 8-bit code of the character.</p></li><li class="listitem"><p>No support for Unicode characters. The code of large characters is simply truncated.</p></li></ul></div><p>The other kind are binary streams. Here input and output is performed in chunks of bits. Binary streams are created with the function <code class="function">open</code> passing as argument a subtype of <span class="type">integer</span>. We distinguish two cases </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The word size is a multiple of 8 bits: element types <span class="type">(byte 8)</span>, <span class="type">(signed-byte 32)</span>, etc.</p></li><li class="listitem"><p>The word size is not a multiple of 8 bits: element types <span class="type">(unsigned-byte 3)</span>, <span class="type">(signed-byte 15)</span>, etc.</p></li></ul></div><p> In the first case the length of the file can be deduced from the number of octets which are used in the filesystem. In the second case, however, one needs some extra information which tells how many bits in the last byte are significant for the content. This information is stored as a single-byte header at the beginning of the file.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch13.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch13.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch14.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 13. Streams </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 14. Printer</td></tr></table></div></body></html>