[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch




/vendor/guzzlehttp/streams/src/ -> AsyncReadStream.php (summary)

(no description)

File Size: 207 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

AsyncReadStream:: (6 methods):

Class: AsyncReadStream  - X-Ref

Represents an asynchronous read-only stream that supports a drain event and
pumping data from a source stream.

The AsyncReadStream can be used as a completely asynchronous stream, meaning
the data you can read from the stream will immediately return only
the data that is currently buffered.

AsyncReadStream can also be used in a "blocking" manner if a "pump" function
is provided. When a caller requests more bytes than are available in the
buffer, then the pump function is used to block until the requested number
of bytes are available or the remote source stream has errored, closed, or
timed-out. This behavior isn't strictly "blocking" because the pump function
can send other transfers while waiting on the desired buffer size to be
ready for reading (e.g., continue to tick an event loop).

__construct(StreamInterface $buffer,array $config = [])   X-Ref
In order to utilize high water marks to tell writers to slow down, the
provided stream must answer to the "hwm" stream metadata variable,
providing the high water mark. If no "hwm" metadata value is available,
then the "drain" functionality is not utilized.

This class accepts an associative array of configuration options.

- drain: (callable) Function to invoke when the stream has drained,
meaning the buffer is now writable again because the size of the
buffer is at an acceptable level (e.g., below the high water mark).
The function accepts a single argument, the buffer stream object that
has drained.
- pump: (callable) A function that accepts the number of bytes to read
from the source stream. This function will block until all of the data
that was requested has been read, EOF of the source stream, or the
source stream is closed.
- size: (int) The expected size in bytes of the data that will be read
(if known up-front).

param: StreamInterface $buffer   Buffer that contains the data that has
param: array           $config   Associative array of options.

create(array $options = [])   X-Ref
Factory method used to create new async stream and an underlying buffer
if no buffer is provided.

This function accepts the same options as AsyncReadStream::__construct,
but added the following key value pairs:

- buffer: (StreamInterface) Buffer used to buffer data. If none is
provided, a default buffer is created.
- hwm: (int) High water mark to use if a buffer is created on your
- max_buffer: (int) If provided, wraps the utilized buffer in a
DroppingStream decorator to ensure that buffer does not exceed a given
length. When exceeded, the stream will begin dropping data. Set the
max_buffer to 0, to use a NullStream which does not store data.
- write: (callable) A function that is invoked when data is written
to the underlying buffer. The function accepts the buffer as the first
argument, and the data being written as the second. The function MUST
return the number of bytes that were written or false to let writers
know to slow down.
- drain: (callable) See constructor documentation.
- pump: (callable) See constructor documentation.

param: array $options Associative array of options.
return: array Returns an array containing the buffer used to buffer

getSize()   X-Ref
No description

isWritable()   X-Ref
No description

write($string)   X-Ref
No description

read($length)   X-Ref
No description

Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1