/** * Create a new buffered stream as needed by a buffered HTTP body. * * @param FilesystemTempStream $temp Temp file stream being used as secondary buffer. * @param ReadableStream $source Source stream that needs buffering. * @param int $bufferSize In-memory buffer size (will be used as read size). * @param BufferedBody $body Buffered HTTP body being used. */ public function __construct(FilesystemTempStream $temp, ReadableStream $source, int $bufferSize, BufferedBody $body) { parent::__construct($temp); $this->source = $source; $this->bufferSize = $bufferSize; $this->body = $body; $this->cascadeClose = false; }
/** * Create a length-limited input stream. * * @param ReadableStream $stream Wrapped input stream. * @param int $limit Maximum number of bytes to be read from the stream. * @param bool $cascadeClose Cascade call to close to wrapped stream? */ public function __construct(ReadableStream $stream, int $limit, bool $cascadeClose = true) { if ($limit < 0) { throw new \InvalidArgumentException('Limit must not be negative'); } parent::__construct($stream); $this->limit = $limit; $this->cascadeClose = $cascadeClose; }
/** * {@inheritdoc} */ public function close() : Awaitable { $this->context = null; return parent::close(); }
/** * {@inheritdoc} */ public function close() : Awaitable { $this->defer->resolve(null); return parent::close(); }
/** * Create a stream that will decode HTTP chunk-encoded data. * * @param ReadableStream $stream Stream that provides chunk-encoded data. * @param bool $cascadeClose Cascade the close operation to the wrapped stream? */ public function __construct(ReadableStream $stream, bool $cascadeClose = true) { parent::__construct($stream); $this->cascadeClose = $cascadeClose; }