Common Lisp Package: BABEL-STREAMS

README:

FUNCTION

Public

MAKE-IN-MEMORY-INPUT-STREAM (DATA &KEY (ELEMENT-TYPE DEFAULT) EXTERNAL-FORMAT)

Returns a binary input stream which provides the elements of DATA when read.

MAKE-IN-MEMORY-OUTPUT-STREAM (&KEY (ELEMENT-TYPE DEFAULT) EXTERNAL-FORMAT INITIAL-BUFFER-SIZE)

Returns a binary output stream which accepts objects of type ELEMENT-TYPE (a subtype of OCTET) and makes available a sequence that contains the octes that were actually output.

Private

CHECK-IF-OPEN (STREAM)

Checks if STREAM is open and signals an error otherwise.

MAKE-VECTOR-STREAM-BUFFER (&KEY (ELEMENT-TYPE '(UNSIGNED-BYTE 8)) INITIAL-SIZE)

Creates and returns an array which can be used as the underlying vector for a VECTOR-OUTPUT-STREAM.

Undocumented

CHECK-IF-ACCEPTS-CHARACTERS (STREAM)

CHECK-IF-ACCEPTS-OCTETS (STREAM)

EXTEND-VECTOR-OUTPUT-STREAM-BUFFER (EXTENSION STREAM &KEY (START 0) (END (LENGTH EXTENSION)))

STREAM-ACCEPTS-CHARACTERS? (STREAM)

STREAM-ACCEPTS-OCTETS? (STREAM)

VECTOR-EXTEND (EXTENSION VECTOR &KEY (START 0) (END (LENGTH EXTENSION)))

WRONG-ELEMENT-TYPE-STREAM-ERROR (STREAM EXPECTED-TYPE)

MACRO

Public

WITH-INPUT-FROM-SEQUENCE ((VAR DATA &KEY (ELEMENT-TYPE ''DEFAULT) (EXTERNAL-FORMAT '*DEFAULT-CHARACTER-ENCODING*)) &BODY BODY)

Creates an IN-MEMORY input stream that will return the values available in DATA, binds VAR to this stream and then executes the code in BODY. The stream stores data of type ELEMENT-TYPE (a subtype of OCTET). The stream is automatically closed on exit from WITH-INPUT-FROM-SEQUENCE, no matter whether the exit is normal or abnormal. The return value of this macro is the return value of BODY.

WITH-OUTPUT-TO-SEQUENCE ((VAR &KEY (RETURN-AS ''VECTOR) (ELEMENT-TYPE ''DEFAULT) (EXTERNAL-FORMAT '*DEFAULT-CHARACTER-ENCODING*) INITIAL-BUFFER-SIZE) &BODY BODY)

Creates an IN-MEMORY output stream, binds VAR to this stream and then executes the code in BODY. The stream stores data of type ELEMENT-TYPE (a subtype of OCTET). The stream is automatically closed on exit from WITH-OUTPUT-TO-SEQUENCE, no matter whether the exit is normal or abnormal. The return value of this macro is a vector (or a list if AS-LIST is true) containing the octets that were sent to the stream within BODY.

GENERIC-FUNCTION

Public

Undocumented

GET-OUTPUT-STREAM-SEQUENCE (STREAM &KEY (RETURN-AS 'VECTOR) &ALLOW-OTHER-KEYS)

Private

Undocumented

EXPECTED-TYPE-OF (CONDITION)

SETFEXPECTED-TYPE-OF (NEW-VALUE CONDITION)

SLOT-ACCESSOR

Private

VECTOR-STREAM-END (OBJECT)

An index into the underlying vector denoting the end of the available data.

SETFVECTOR-STREAM-END (NEW-VALUE OBJECT)

An index into the underlying vector denoting the end of the available data.

VECTOR-STREAM-INDEX (OBJECT)

An index into the underlying vector denoting the current position.

SETFVECTOR-STREAM-INDEX (NEW-VALUE OBJECT)

An index into the underlying vector denoting the current position.

VECTOR-STREAM-VECTOR (OBJECT)

The underlying vector of the stream which (for output) must always be adjustable and have a fill pointer.

SETFVECTOR-STREAM-VECTOR (NEW-VALUE OBJECT)

The underlying vector of the stream which (for output) must always be adjustable and have a fill pointer.

Undocumented

ELEMENT-TYPE-OF (OBJECT)

SETFELEMENT-TYPE-OF (NEW-VALUE OBJECT)

EXTERNAL-FORMAT-OF (OBJECT)

SETFEXTERNAL-FORMAT-OF (NEW-VALUE OBJECT)

CLASS

Public

IN-MEMORY-STREAM

An IN-MEMORY-STREAM is a binary stream that reads octets from or writes octets to a sequence in RAM.

VECTOR-INPUT-STREAM

A binary input stream that gets its data from an associated vector of octets.

VECTOR-OUTPUT-STREAM

A binary output stream that writes its data to an associated vector.

Private

IN-MEMORY-INPUT-STREAM

An IN-MEMORY-INPUT-STREAM is a binary stream that reads octets from a sequence in RAM.

IN-MEMORY-OUTPUT-STREAM

An IN-MEMORY-OUTPUT-STREAM is a binary stream that writes octets to a sequence in RAM.

VECTOR-STREAM

A VECTOR-STREAM is a mixin for IN-MEMORY streams where the underlying sequence is a vector.

CONDITION

Private

IN-MEMORY-STREAM-CLOSED-ERROR

An error that is signalled when someone is trying to read from or write to a closed IN-MEMORY stream.

IN-MEMORY-STREAM-ERROR

Superclass for all errors related to IN-MEMORY streams.

Undocumented

WRONG-ELEMENT-TYPE-STREAM-ERROR (STREAM EXPECTED-TYPE)