@@ -753,21 +753,22 @@ take care of the underlying stream resource.
753753You SHOULD only use its public API and SHOULD NOT interfere with the underlying
754754stream resource manually.
755755
756- The ` $bufferSize ` property controls the maximum buffer size in bytes to read
757- at once from the stream.
756+ This class takes an optional ` int|null $readChunkSize ` parameter that controls
757+ the maximum buffer size in bytes to read at once from the stream.
758+ You can use a ` null ` value here in order to apply its default value.
758759This value SHOULD NOT be changed unless you know what you're doing.
759760This can be a positive number which means that up to X bytes will be read
760761at once from the underlying stream resource. Note that the actual number
761762of bytes read may be lower if the stream resource has less than X bytes
762763currently available.
763- This can be ` null ` which means "read everything available" from the
764+ This can be ` -1 ` which means "read everything available" from the
764765underlying stream resource.
765766This should read until the stream resource is not readable anymore
766767(i.e. underlying buffer drained), note that this does not neccessarily
767768mean it reached EOF.
768769
769770``` php
770- $stream->bufferSize = 8192;
771+ $stream = new ReadableResourceStream(STDIN, $loop, 8192) ;
771772```
772773
773774### WritableResourceStream
@@ -819,11 +820,14 @@ ready to accept data.
819820For this, it uses an in-memory buffer string to collect all outstanding writes.
820821This buffer has a soft-limit applied which defines how much data it is willing
821822to accept before the caller SHOULD stop sending further data.
822- It currently defaults to 64 KiB and can be controlled through the public
823- ` $softLimit ` property like this:
823+
824+ This class takes an optional ` int|null $writeBufferSoftLimit ` parameter that controls
825+ this maximum buffer size in bytes.
826+ You can use a ` null ` value here in order to apply its default value.
827+ This value SHOULD NOT be changed unless you know what you're doing.
824828
825829``` php
826- $stream->softLimit = 8192;
830+ $stream = new WritableResourceStream(STDOUT, $loop, 8192) ;
827831```
828832
829833See also [ ` write() ` ] ( #write ) for more details.
@@ -873,21 +877,23 @@ take care of the underlying stream resource.
873877You SHOULD only use its public API and SHOULD NOT interfere with the underlying
874878stream resource manually.
875879
876- The ` $bufferSize ` property controls the maximum buffer size in bytes to read
877- at once from the stream.
880+ This class takes an optional ` int|null $readChunkSize ` parameter that controls
881+ the maximum buffer size in bytes to read at once from the stream.
882+ You can use a ` null ` value here in order to apply its default value.
878883This value SHOULD NOT be changed unless you know what you're doing.
879884This can be a positive number which means that up to X bytes will be read
880885at once from the underlying stream resource. Note that the actual number
881886of bytes read may be lower if the stream resource has less than X bytes
882887currently available.
883- This can be ` null ` which means "read everything available" from the
888+ This can be ` -1 ` which means "read everything available" from the
884889underlying stream resource.
885890This should read until the stream resource is not readable anymore
886891(i.e. underlying buffer drained), note that this does not neccessarily
887892mean it reached EOF.
888893
889894``` php
890- $stream->bufferSize = 8192;
895+ $conn = stream_socket_client('tcp://google.com:80');
896+ $stream = new DuplexResourceStream($conn, $loop, 8192);
891897```
892898
893899Any ` write() ` calls to this class will not be performaned instantly, but will
@@ -896,15 +902,22 @@ ready to accept data.
896902For this, it uses an in-memory buffer string to collect all outstanding writes.
897903This buffer has a soft-limit applied which defines how much data it is willing
898904to accept before the caller SHOULD stop sending further data.
899- It currently defaults to 64 KiB and can be controlled through the public
900- ` $softLimit ` property like this:
905+
906+ This class takes another optional ` WritableStreamInterface|null $buffer ` parameter
907+ that controls this write behavior of this stream.
908+ You can use a ` null ` value here in order to apply its default value.
909+ This value SHOULD NOT be changed unless you know what you're doing.
910+
911+ If you want to change the write buffer soft limit, you can pass an instance of
912+ [ ` WritableResourceStream ` ] ( #writableresourcestream ) like this:
901913
902914``` php
903- $buffer = $stream->getBuffer();
904- $buffer->softLimit = 8192;
915+ $conn = stream_socket_client('tcp://google.com:80');
916+ $buffer = new WritableResourceStream($conn, $loop, 8192);
917+ $stream = new DuplexResourceStream($conn, $loop, null, $buffer);
905918```
906919
907- See also [ ` write() ` ] ( #write ) for more details.
920+ See also [ ` WritableResourceStream ` ] ( #writableresourcestream ) for more details.
908921
909922### ThroughStream
910923
0 commit comments