redirect stream
1.0.0Offers a stream that redirects all actions to an inner stream.
Table of Contents
About Redirect-Stream
This is a very simple implementation of a gray stream that redirects all stream operations it receives to another stream. This is useful in situations where you would like to change the target of operations at any point in time without being able to change the actual binding of the stream that is being operated on.
How To
Load it with Quicklisp or ASDF
(ql:quickload :redirect-stream)
Let's create a redirect stream.
(defvar *stream* (redirect-stream:make-redirect-stream))
At this point there's no stream inside the redirect-stream, so doing anything won't result in anything useful.
(print 0 *stream*)
So let's change that.
(setf (redirect-stream:stream *stream*) *standard-output*)
(print 0 *stream*)
We can also use it for input.
(setf (redirect-stream:stream *stream*) *standard-input*)
(read-line *stream*)
And that's pretty much it, really. It just redirects everything, just as one might guess.
System Information
Definition Index
-
REDIRECT-STREAM
- ORG.SHIRAKUMO.REDIRECT-STREAM
No documentation provided.-
EXTERNAL CLASS REDIRECT-STREAM
A gray-stream class that redirects all stream operations to its STREAM object. If STREAM is NIL, a stream operation will do nothing and return NIL. Otherwise the exact same operation with the exact same parameters is performed on STREAM. See STREAM
-
EXTERNAL FUNCTION MAKE-REDIRECT-STREAM
- &OPTIONAL
- STREAM
- &REST
Creates a new REDIRECT-STREAM that directs all operations to STREAM. See STREAM See REDIRECT-STREAM
-
EXTERNAL GENERIC-FUNCTION STREAM
- OBJECT
- &REST
Returns the stream the REDIRECT-STREAM redirects to. SETF-able. See REDIRECT-STREAM
-
EXTERNAL GENERIC-FUNCTION (SETF STREAM)
- NEW-VALUE
- OBJECT
- &REST
No documentation provided.