Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LimitStream.php

function LimitStream::seek

Allow for a bounded seek on the read limited stream

Overrides StreamDecoratorTrait::seek

File

vendor/guzzlehttp/psr7/src/LimitStream.php, line 74

Class

LimitStream
Decorator used to return only a subset of a stream.

Namespace

GuzzleHttp\Psr7

Code

public function seek($offset, $whence = SEEK_SET) : void {
    if ($whence !== SEEK_SET || $offset < 0) {
        throw new \RuntimeException(sprintf('Cannot seek to offset %s with whence %s', $offset, $whence));
    }
    $offset += $this->offset;
    if ($this->limit !== -1) {
        if ($offset > $this->offset + $this->limit) {
            $offset = $this->offset + $this->limit;
        }
    }
    $this->stream
        ->seek($offset);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal