echo-stream
echo-stream System Class
Class Precedence List:
echo-stream, stream, t
Description:
An echo stream is a bidirectional stream that gets its input from an associated input stream and sends its output to an associated output stream.
All input taken from the input stream is echoed to the output stream. Whether the input is echoed immediately after it is encountered, or after it has been read from the input stream is implementation-dependent.
See Also:
echo-stream-input-stream, echo-stream-output-stream, make-echo-stream
Expanded Reference: echo-stream
Overview
An echo-stream is a bidirectional stream that gets input from an associated input stream and sends output to an associated output stream. All input read from the echo stream is automatically echoed (copied) to the output stream.
Type Check
(let ((echo (make-echo-stream
(make-string-input-stream "x")
(make-string-output-stream))))
(typep echo 'echo-stream))
=> T
Input Is Echoed
(let ((out (make-string-output-stream)))
(let ((echo (make-echo-stream
(make-string-input-stream "abc")
out)))
(read-char echo)
(read-char echo)
(get-output-stream-string out)))
=> "ab"
Bidirectional
An echo stream supports both input and output.
(let ((echo (make-echo-stream
(make-string-input-stream "test")
(make-string-output-stream))))
(list (input-stream-p echo)
(output-stream-p echo)))
=> (T T)