Version 1 (modified by gz, 11 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.)


Encodes the integer VALUE, which should be non-negative, on the VECTOR-OUTPUT-STREAM S using ULEB128.


Encodes the integer VALUE on the VECTOR-OUTPUT-STREAM S. Negative integers are encoded in SLEB128 and non-negative integers in ULEB128.

PARSE-UNSIGNED-INTEGER vector &optional (start 0) end

Decodes a ULEB128-encoded integer from the bounded range of VECTOR, which must be of type (VECTOR (UNSIGNED-BYTE 8)). Returns two values: that integer and the the index of the first octet in VECTOR that follows the encoded integer. (The second value will be > start and <= end)

PARSE-SIGNED-INTEGER vector &optional (start 0) end

As PARSE-UNSIGNED-INTEGER, but assumes SLEB128 encoding and may return a negative first value.


Decodes a ULEB128-encoded integer from the VECTOR-INPUT-STREAM S and returns that value.


Decodes an SLEB128-encoded integer from the VECTOR-INPUT-STREAM S and returns that value.