STREAM-ELEMENT-TYPESTREAM-ELEMENT-TYPE is SETFable. The STREAM-ELEMENT-TYPE of
STREAMs created by the functions OPEN, EXT:MAKE-PIPE-INPUT-STREAM
EXT:MAKE-PIPE-OUTPUT-STREAM, EXT:MAKE-PIPE-IO-STREAM, SOCKET:SOCKET-ACCEPT, SOCKET:SOCKET-CONNECT
can be modified, if the old and the new STREAM-ELEMENT-TYPEs are either
CHARACTER or
(UNSIGNED-BYTE 8) or (SIGNED-BYTE 8); or(UNSIGNED-BYTE n) or (SIGNED-BYTE n), with the
same n.Functions STREAM-ELEMENT-TYPE and ( are SETF
STREAM-ELEMENT-TYPE)GENERIC-FUNCTIONs, see
Chapter 30, Gray streams.
CLISP expects to be able to
do CHARACTER i/o on standard streams like *TERMINAL-IO*,
*STANDARD-OUTPUT*, *STANDARD-INPUT*, *ERROR-OUTPUT*,
*QUERY-IO* et al, thus it is a very bad idea
to change their STREAM-ELEMENT-TYPE even when you can. Use
EXT:MAKE-STREAM instead, see Section 21.8.1, “Binary input from *STANDARD-INPUT*”.
*STANDARD-INPUT*Note that you cannot change STREAM-ELEMENT-TYPE for some
built-in streams, such as terminal streams,
which is normally the value of *TERMINAL-IO*.
Since *STANDARD-INPUT* normally is a SYNONYM-STREAM pointing
to *TERMINAL-IO*, you cannot use READ-BYTE on it.
Since CGI
(Common Gateway Interface) provides the form data for
METHOD="POST" on the stdin,
and the server will not send you an end-of-stream on the end of the data,
you will need to use
(
to determine how much data you should read from EXT:GETENV "CONTENT_LENGTH")stdin.
CLISP will detect that stdin is not a terminal and create a regular
FILE-STREAM which can be passed to (.
To test this functionality interactively,
you will need to open the standard input in the binary mode:
SETF
STREAM-ELEMENT-TYPE)
(let ((buf (MAKE-ARRAY(PARSE-INTEGER(EXT:GETENV"CONTENT_LENGTH")) :element-type '())) (UNSIGNED-BYTE8)WITH-OPEN-STREAM(in (EXT:MAKE-STREAM:INPUT:ELEMENT-TYPE'()) (UNSIGNED-BYTE8)READ-SEQUENCEbuf in)) buf)
| These notes document CLISP version 2.49.93+ | Last modified: 2018-02-19 |