| 1 |
@node Gray Streams |
| 2 |
@section Gray Streams |
| 3 |
|
| 4 |
@defun {close} stream &key abort |
| 5 |
Unlike the other Gray stream functions, @code{close} is not specialized |
| 6 |
on @code{t} for @var{stream}. This decision has been taken mainly for |
| 7 |
the compatibility reasons with some libraries. |
| 8 |
@end defun |
| 9 |
|
| 10 |
@defun {stream-file-position} stream &optional position |
| 11 |
This is used to implement @code{file-position}. When @code{position} |
| 12 |
is not provided it should return the current file position of the |
| 13 |
stream as non-negative integer or @code{nil} if the file position |
| 14 |
cannot be determined. When @code{position} is supplied the file |
| 15 |
position of the stream should be set to that value. If setting the |
| 16 |
position is successful then @code{t} should be returned, otherwise |
| 17 |
@code{nil} should be returned. The default method always returns |
| 18 |
@code{nil}. |
| 19 |
@end defun |
| 20 |
|
| 21 |
@defun {stream-file-length} stream |
| 22 |
This is used to implement @code{file-length}. It returns either a |
| 23 |
non-negative integer or @code{nil} if the concept of file length is |
| 24 |
not meaningful for the stream. The default method will signal a |
| 25 |
@code{type-error} with an expected type of @code{file-stream}. This is |
| 26 |
required to conform with the ``Exceptional Situations'' section of |
| 27 |
@code{file-length} in the ANSI specification. |
| 28 |
@end defun |
| 29 |
|
| 30 |
@defun {stream-interactive-p} stream |
| 31 |
This is used to implement @code{interactive-stream-p}. It returns a |
| 32 |
boolean indicating if the stream is interactive. The default method |
| 33 |
always returns @code{nil}. |
| 34 |
@end defun |
| 35 |
|
| 36 |
@defun {stream-line-length} stream |
| 37 |
Allows the default line length to be specified for the stream. It |
| 38 |
returns either a non-negative integer or @code{nil} if the concept of |
| 39 |
line length is not meaningful for the stream. This value is only used |
| 40 |
if @code{*print-right-margin*} is @code{nil}. The line length is used |
| 41 |
by the pretty printer and by the format justification directive. The |
| 42 |
default method returns @code{nil}. |
| 43 |
@end defun |
| 44 |
|
| 45 |
@defun {stream-read-sequence} stream sequence &optional start end |
| 46 |
This is used to implement @code{read-sequence}. It should follow the |
| 47 |
semantics in the ANSI specification. It returns the position of the |
| 48 |
first element in the sequence that was not updated. The default method |
| 49 |
calls @code{stream-read-char} or @code{stream-read-byte} repeatedly |
| 50 |
based on the type returned by @code{stream-element-type}. Element |
| 51 |
access to the sequence is done via @code{elt}. |
| 52 |
@end defun |
| 53 |
|
| 54 |
@defun {stream-write-sequence} stream sequence &optional start end |
| 55 |
This is used to implement @code{write-sequence}. It should follow the |
| 56 |
semantics in the ANSI specification. It returns sequence without |
| 57 |
modification. The default method calls @code{stream-write-char} or |
| 58 |
@code{stream-write-byte} repeatedly based on the type returned by |
| 59 |
@code{stream-element-type}. Element access to the sequence is done via |
| 60 |
@code{elt}. |
| 61 |
@end defun |
| 62 |
|
| 63 |
@subsection Gray Stream Extensions |
| 64 |
|
| 65 |
@defun {stream-unread-byte} stream byte |
| 66 |
Un-do the last call to @code{stream-read-byte}, as in @code{ext:unread-byte}. |
| 67 |
Return @code{nil}. Every subclass of @code{fundamental-binary-input-stream} |
| 68 |
should define a method for this function. A default method signals an error. |
| 69 |
@end defun |
| 70 |
|
| 71 |
@defun {stream-peek-byte} stream |
| 72 |
This is used to implement @code{ext:peek-byte}. It returns either a byte |
| 73 |
or @code{:eof}. A default method calls @code{stream-read-byte} and |
| 74 |
@code{stream-unread-byte}. |
| 75 |
@end defun |