Skip to content

Latest commit

 

History

History
542 lines (175 loc) · 3.83 KB

DroppingStream.md

File metadata and controls

542 lines (175 loc) · 3.83 KB

DroppingStream

Stream decorator that begins dropping data once the size of the underlying stream becomes too full.

  • Full name: \GuzzleHttp\Psr7\DroppingStream
  • This class is marked as final and can't be subclassed
  • This class implements: \Psr\Http\Message\StreamInterface
  • This class is a Final class

Properties

maxLength

private int $maxLength

stream

private \Psr\Http\Message\StreamInterface $stream

Methods

__construct

public __construct(\Psr\Http\Message\StreamInterface $stream, int $maxLength): mixed

Parameters:

Parameter Type Description
$stream \Psr\Http\Message\StreamInterface Underlying stream to decorate.
$maxLength int Maximum size before dropping data.

write

Write data to the stream.

public write(mixed $string): int

Parameters:

Parameter Type Description
$string mixed The string that is to be written.

Return Value:

Returns the number of bytes written to the stream.


Inherited methods

__construct

public __construct(\Psr\Http\Message\StreamInterface $stream): mixed

Parameters:

Parameter Type Description
$stream \Psr\Http\Message\StreamInterface Stream to decorate

__get

Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).

public __get(string $name): \Psr\Http\Message\StreamInterface

Parameters:

Parameter Type Description
$name string

__toString

public __toString(): string

getContents

public getContents(): string

__call

Allow decorators to implement custom methods

public __call(string $method, array $args): mixed

Parameters:

Parameter Type Description
$method string
$args array

close

public close(): void

getMetadata

{@inheritdoc}

public getMetadata(mixed $key = null): mixed

Parameters:

Parameter Type Description
$key mixed

detach

public detach(): mixed

getSize

public getSize(): ?int

eof

public eof(): bool

tell

public tell(): int

isReadable

public isReadable(): bool

isWritable

public isWritable(): bool

isSeekable

public isSeekable(): bool

rewind

public rewind(): void

seek

public seek(mixed $offset, mixed $whence = SEEK_SET): void

Parameters:

Parameter Type Description
$offset mixed
$whence mixed

read

public read(mixed $length): string

Parameters:

Parameter Type Description
$length mixed

write

public write(mixed $string): int

Parameters:

Parameter Type Description
$string mixed

createStream

Implement in subclasses to dynamically create streams when requested.

protected createStream(): \Psr\Http\Message\StreamInterface