|Version 2 (modified by gb, 7 years ago) (diff)|
Vector streams are similar to STRING streams but use vectors of (UNSIGNED-BYTE 8) and allow binary as well as character I/O.
Type of input vector streams.
Type of output vector streams.
MAKE-VECTOR-OUTPUT-STREAM &key external-format
Returns a VECTOR-OUTPUT-STREAM. Character output on that stream is encoded according to the specified external format (which is handled as it is by other CCL stream classes.)
S should be a VECTOR-OUTPUT-STREAM. Returns a (SIMPLE-ARRAY (UNSIGNED-BYTE) (*)) of all bytes written to S since it was created or since the last call GET-OUTPUT-STREAM-VECTOR on S.
WITH-OUTPUT-TO-VECTOR var &optional vector &key external-format &body body
Like WITH-OUTPUT-TO-STRING (too much like it, in fact.) Executes BODY with VAR bound to a VECTOR-OUTPUT-STREAM. If VECTOR is non-null, it should be a (VECTOR (UNSIGNED-BYTE 8)) with a fill-pointer; the value(s) returned by BODY are returned and the vector's contents and fill-pointer are updated at the end of the WITH-OUTPUT-TO-VECTOR form. If VECTOR is NIL, returns the result of (GET-OUTPUT-STREAM-VECTOR var) after executing BODY.
WITH-INPUT-FROM-VECTOR var vector &key (start 0) end external-format &body body
Like WITH-INPUT-FROM-STRING. VECTOR should be a (VECTOR (UNSIGNED-BYTE 8)). Executes BODY with VAR bound to a VECTOR-INPUT-STREAM constructed from VECTOR (bounded by START and END.)
UNSIGNED-INTEGER-TO-BINARY value len s
Encodes the least significant (* LEN 8) bits of the integer VALUE in LEN big-endian bytes on the VECTOR-OUTPUT-STREAM S.
SIGNED-INTEGER-TO-BINARY value len s
Encodes the integer VALUE in LEN big-endian bytes on the VECTOR-OUTPUT-STREAM S.
PARSE-UNSIGNED-INTEGER vector &optional (start 0) end
Decodes a big-endian-encoded unsigned integer from the bounded range of VECTOR, which must be of type (VECTOR (UNSIGNED-BYTE 8)).
PARSE-SIGNED-INTEGER vector &optional (start 0) end
As PARSE-UNSIGNED-INTEGER, but interprets the bytes as encoding a signed integer and may return a negative value.
PUI-STREAM s count
Decodes an unsigned integer encoded in COUNT bytes of big-endian data from the VECTOR-INPUT-STREAM S and returns that value.
PSI-STREAM s count
Decodes a signed integer encoded in COUNT bytes of big-endian data from the VECTOR-INPUT-STREAM S and returns that value.