Pipe data from a @see \io\vertx\jphp\core\streams\ReadStream to a @see \io\vertx\jphp\core\streams\WriteStream and performs flow control where necessary to prevent the write stream buffer from getting overfull.
Instances of this class read items from a @see \io\vertx\jphp\core\streams\ReadStream and write them to a @see \io\vertx\jphp\core\streams\WriteStream. If data can be read faster than it can be written this could result in the write queue of the @see \io\vertx\jphp\core\streams\WriteStream growing without bound, eventually causing it to exhaust all available RAM.
To prevent this, after each write, instances of this class check whether the write queue of the @see \io\vertx\jphp\core\streams\WriteStream is full, and if so, the @see \io\vertx\jphp\core\streams\ReadStream is paused, and a drainHandler
is set on the
see |
When the @see \io\vertx\jphp\core\streams\WriteStream has processed half of its backlog, the This class can be used to pipe from any @see \io\vertx\jphp\core\streams\ReadStream to any @see \io\vertx\jphp\core\streams\WriteStream, e.g. from an @see \io\vertx\jphp\core\http\HttpServerRequest to an @see \io\vertx\jphp\core\file\AsyncFile, or from @see \io\vertx\jphp\core\net\NetSocket to a @see \io\vertx\jphp\core\http\WebSocket. Please see the documentation for more information. |
---|---|
package |
Default |
__construct()
close() : void
The streams handlers will be unset and the read stream resumed unless it is already ended.
endOnComplete( $arg0) : $this
Calling this overwrites @see \io\vertx\jphp\core\streams\Pipe::endOnFailure and @see \io\vertx\jphp\core\streams\Pipe::endOnSuccess.
boolean
$this
a reference to this, so the API can be used fluently
endOnFailure( $arg0) : $this
boolean
$this
a reference to this, so the API can be used fluently
endOnSuccess( $arg0) : $this
boolean
$this
a reference to this, so the API can be used fluently
to( $arg0, $arg1 = null) : void
param $dst [WriteStream
Start to pipe the elements to the destination WriteStream
.
When the operation fails with a write error, the source stream is resumed.
param $dst [WriteStream
WriteStream
callable