Method
StringBuffer::write
Appends $chunk to the buffer, and wakes the reader.
Description#
public StringBuffer::write(
string $chunk,
float $timeout = PHP_FLOAT_MAX
): voidWith a $maxSize and that much data unread, it waits until the reader has consumed enough. A $timeout of 0 never waits and writes past $maxSize, so the limit is backpressure and not a ceiling.
Parameters#
- $chunk string
- The bytes to append
- $timeout float = PHP_FLOAT_MAX
- Seconds to wait for room at most
Errors / Exceptions#
| Exception | When |
|---|---|
RuntimeException | If the buffer has ended |
TimeoutException | If there was no room in time |
See also#
StringBuffer::endMarks the end of the stream: no more writes are accepted, and readers get the data left and then the end.