30.6. Generic functions for binary input

Generic functions for binary input

(GRAY:STREAM-READ-BYTE stream)

Returns and consumes the next integer from the stream. Returns :EOF if the end-of-stream is reached.

You must define a method for this function.

(GRAY:STREAM-READ-BYTE-LOOKAHEAD stream)

To be called only if stream's STREAM-ELEMENT-TYPE is (UNSIGNED-BYTE 8) or (SIGNED-BYTE 8). Returns T if GRAY:STREAM-READ-BYTE would return immediately with an INTEGER result. Returns :EOF if the end-of-stream is already known to be reached. If GRAY:STREAM-READ-BYTE's value is not available immediately, returns NIL instead of waiting.

You must define a method for this function.

This function is a CLISP extension (see EXT:READ-BYTE-LOOKAHEAD).

(GRAY:STREAM-READ-BYTE-WILL-HANG-P stream)

To be called only if stream's STREAM-ELEMENT-TYPE is (UNSIGNED-BYTE 8) or (SIGNED-BYTE 8). Returns NIL if GRAY:STREAM-READ-BYTE will return immediately. Otherwise it returns true.

The default method calls GRAY:STREAM-READ-BYTE-LOOKAHEAD; this is always sufficient.

This function is a CLISP extension (see EXT:READ-BYTE-WILL-HANG-P).

(GRAY:STREAM-READ-BYTE-NO-HANG stream)

To be called only if stream's STREAM-ELEMENT-TYPE is (UNSIGNED-BYTE 8) or (SIGNED-BYTE 8). Returns an INTEGER or :EOF, like GRAY:STREAM-READ-BYTE, if that would return immediately. If GRAY:STREAM-READ-BYTE's value is not available immediately, returns NIL instead of waiting.

The default method calls GRAY:STREAM-READ-BYTE if GRAY:STREAM-READ-BYTE-LOOKAHEAD returns true; this is always sufficient.

This function is a CLISP extension (see EXT:READ-BYTE-NO-HANG).

(GRAY:STREAM-READ-BYTE-SEQUENCE stream sequence &OPTIONAL [start [end [no-hang [interactive]]]])

Fills the subsequence of sequence specified by :START and :END with integers consecutively read from stream. Returns the index of the first element of sequence that was not updated (= end, or < end if the stream reached its end).

sequence is an ARRAY of INTEGERs. start is a nonnegative INTEGER and defaults to 0. end is a nonnegative INTEGER or NIL and defaults to NIL, which stands for (LENGTH sequence). If no-hang is true, the function should avoid blocking and instead fill only as many elements as are immediately available. If no-hang is false and interactive is true, the function can block for reading the first byte but should avoid blocking for any further bytes.

The default method repeatedly calls GRAY:STREAM-READ-BYTE; this is always sufficient if speed does not matter.

This function is a CLISP extension (see EXT:READ-BYTE-SEQUENCE).


These notes document CLISP version 2.49.60+Last modified: 2017-11-20