Documentation

BufferedReader
in package
uses ForbidCloning, ForbidSerialization

FinalYes

Table of Contents

Properties

$buffer  : string
$pending  : bool
$stream  : ReadableStream

Methods

__construct()  : mixed
__serialize()  : never
__unserialize()  : never
buffer()  : string
drain()  : string
isReadable()  : bool
read()  : string|null
readLength()  : string
readUntil()  : string
__clone()  : mixed
guard()  : mixed

Properties

Methods

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : never
Parameters
$data : array<string|int, mixed>
Return values
never

readLength()

public readLength(positive-int $length[, Cancellation|null $cancellation = null ]) : string
Parameters
$length : positive-int

The number of bytes to read from the stream.

$cancellation : Cancellation|null = null
Tags
throws
StreamException

If the implementation of ReadableStream::read() of the instance given the constructor can throw.

throws
BufferException

If the stream closes before the given number of bytes are read.

Return values
string

readUntil()

public readUntil(non-empty-string $delimiter[, Cancellation|null $cancellation = null ][, positive-int $limit = PHP_INT_MAX ]) : string
Parameters
$delimiter : non-empty-string

Read from the stream until the given delimiter is found in the stream, at which point all bytes up to the delimiter will be returned (but not the delimiter).

$cancellation : Cancellation|null = null
$limit : positive-int = PHP_INT_MAX
Tags
throws
StreamException

If the implementation of ReadableStream::read() of the instance given the constructor can throw.

throws
BufferException

If the stream closes before the delimiter is found in the stream or if the buffer exceeds $limit.

Return values
string

guard()

private guard(callable(): TString $read) : mixed
Parameters
$read : callable(): TString
Tags
template

        
On this page

Search results