The generic function stream-flush-buffer is called by the writing functions to flush a stream buffer to the underlying data sink.
stream should be an instance of a subclass of buffered-stream.
Before returning, stream-flush-buffer must set the output index of stream so that more characters can be written to the buffer. If desired, the output buffer and limit can be set too.
There is a built-in method specialized on buffered-stream which usually suffices. It calls stream-write-buffer with the currently active part of the stream's output buffer and sets the output index to 0.