Decorator used to return only a subset of a stream.

public __call(string $method, array $args)

Allow decorators to implement custom methods

  • return mixed
public __construct(Psr\Http\Message\StreamInterface $stream, int $limit = -1, int $offset = 0)
  • param StreamInterface $stream Stream to wrap
  • param int $limit Total number of bytes to allow to be read
    from the stream. Pass -1 for no limit.
  • param int $offset Position to seek to before reading (only
    works on seekable streams).
public __get(string $name)

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

  • return StreamInterface
public __toString() : string
public close() : void
public detach()
public eof() : bool
public getContents() : string
public getMetadata( $key = NULL)
  • return mixed
public getSize() : ?int

Returns the size of the limited subset of data

public isReadable() : bool
public isSeekable() : bool
public isWritable() : bool
public read( $length) : string
public rewind() : void
public seek( $offset, $whence = 0GuzzleHttp\Psr7\SEEK_SET) : void

Allow for a bounded seek on the read limited stream

public setLimit(int $limit) : void

Set the limit of bytes that the decorator allows to be read from the

  • param int $limit Number of bytes to allow to be read from the stream.
    Use -1 for no limit.
public setOffset(int $offset) : void

Set the offset to start limiting from

  • param int $offset Offset to seek to and begin byte limiting from
  • throws RuntimeException if the stream cannot be seeked.
public tell() : int

Give a relative tell()

public write( $string) : int
protected createStream() : Psr\Http\Message\StreamInterface

Implement in subclasses to dynamically create streams when requested.

  • throws BadMethodCallException
private $limit
  • var int Limit the number of bytes that can be read
private $offset
  • var int Offset to start reading from
private $stream
  • var StreamInterface
© 2022 Bruce Wells
Search Namespaces \ Classes