Bivalent Streams - SBCL 1.0.31 User Manual
Description: SBCL 1.0.31 User Manual

Next: Gray Streams, Up: Extensible Streams

### 10.1 Bivalent Streams

A bivalent stream can be used to read and write both `character` and `(unsigned-byte 8)` values. A bivalent stream is created by calling `open` with the argument `:element-type :default`. On such a stream, both binary and character data can be read and written with the usual input and output functions.

> Streams are not created bivalent by default for performance reasons. Bivalent streams are incompatible with `fast-read-char`, an internal optimization in sbcl's stream machinery that bulk-converts octets to characters and implements a fast path through `read-char`.