Version 1 (modified by gz, 10 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]

**VECTOR-INPUT-STREAM**

Type of input vector streams.

[Type]

**VECTOR-OUTPUT-STREAM**

Type of output vector streams.

[Function]

**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.)

[Function]

**GET-OUTPUT-STREAM-VECTOR** `s`

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.

[Macro]

**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.

[Macro]

**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.)

[Function]

**UNSIGNED-INTEGER-TO-BINARY** `value s`

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

[Function]

**SIGNED-INTEGER-TO-BINARY** `value s`

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

[Function]

**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)

[Function]

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

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

[Function]

**PUI-STREAM** `s`

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

[Function]

**PSI-STREAM** `s`

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