A stream class giving access to stream buffers.
. This argument is required.
provides default methods for the majority of the functions in the User Defined Streams protocol. The default methods implement buffered I/O, requiring the user to define only the methods stream-read-buffer, stream-write-buffer and stream-element-type for each subclass of
. You are at liberty to redefine other methods in subclasses as long as they obey the rules outlined here. For example it is usually desirable to implement methods on stream-listen, stream-check-eof-no-hang and close as well.
The initargs are handled by the method
(method initialize-instance :after (buffered-stream))
Input and/or output buffers are created based on the value
. There is no default value, and you must supply a value.
determines the stream-element-type of the stream. The default is
. For binary streams, use
All the methods in the User Defined Streams protocol are defined for
The methods on stream-read-char, stream-read-line, stream-read-sequence, stream-unread-char, stream-read-char-no-hang, stream-clear-input handle input from the buffer. They each call stream-fill-buffer to fill the empty buffer as required.
The methods on stream-write-char, stream-write-string, stream-write-sequence, stream-clear-output, stream-finish-output, stream-force-output and stream-line-column handle output to the buffer. They each call stream-flush-buffer to make the buffer empty as required.
methods on stream-listen and close which handle the buffer.
The methods on input-stream-p, output-stream-p return the appropriate values based on the value of the
The open-stream-p method returns true if close has not been called.
See the extended example in
LispWorks User Guide and Reference Manual - 22 Dec 2009