Lines Matching refs:buffer

14  * buffer, then the pump function is used to block until the requested number
17 * can send other transfers while waiting on the desired buffer size to be
26 /** @var callable|null Fn used to notify writers the buffer has drained */
32 /** @var int|null Highwater mark of the underlying buffer */
50 * meaning the buffer is now writable again because the size of the
51 * buffer is at an acceptable level (e.g., below the high water mark).
52 * The function accepts a single argument, the buffer stream object that
61 * @param StreamInterface $buffer Buffer that contains the data that has
65 * @throws \InvalidArgumentException if the buffer is not readable and
69 StreamInterface $buffer,
72 if (!$buffer->isReadable() || !$buffer->isWritable()) {
94 $this->hwm = $buffer->getMetadata('hwm');
101 $this->stream = $buffer;
105 * Factory method used to create new async stream and an underlying buffer
106 * if no buffer is provided.
111 * - buffer: (StreamInterface) Buffer used to buffer data. If none is
112 * provided, a default buffer is created.
113 * - hwm: (int) High water mark to use if a buffer is created on your
115 * - max_buffer: (int) If provided, wraps the utilized buffer in a
116 * DroppingStream decorator to ensure that buffer does not exceed a given
120 * to the underlying buffer. The function accepts the buffer as the first
129 * @return array Returns an array containing the buffer used to buffer
139 $buffer = new NullStream();
140 } elseif (isset($options['buffer'])) {
141 $buffer = $options['buffer'];
144 $buffer = new BufferStream($hwm);
148 $buffer = new DroppingStream($buffer, $options['max_buffer']);
154 $buffer = FnStream::decorate($buffer, [
155 'write' => function ($string) use ($buffer, $onWrite) {
156 $result = $buffer->write($string);
157 $onWrite($buffer, $string);
163 return [$buffer, new self($buffer, $options)];
189 // If we need to drain, then drain when the buffer is empty.
198 // If a pump was provided, the buffer is still open, and not enough