You are here

public function RelativeStream::seek in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-diactoros/src/RelativeStream.php \Zend\Diactoros\RelativeStream::seek()

Seek to a position in the stream.

@link http://www.php.net/manual/en/function.fseek.php

Parameters

int $offset Stream offset:

int $whence Specifies how the cursor position will be calculated: based on the seek offset. Valid values are identical to the built-in PHP $whence values for `fseek()`. SEEK_SET: Set position equal to offset bytes SEEK_CUR: Set position to current location plus offset SEEK_END: Set position to end-of-stream plus offset.

Throws

\RuntimeException on failure.

Overrides StreamInterface::seek

2 calls to RelativeStream::seek()
RelativeStream::rewind in vendor/zendframework/zend-diactoros/src/RelativeStream.php
Seek to the beginning of the stream.
RelativeStream::__toString in vendor/zendframework/zend-diactoros/src/RelativeStream.php
Reads all data from the stream into a string, from the beginning to end.

File

vendor/zendframework/zend-diactoros/src/RelativeStream.php, line 105

Class

RelativeStream
Class RelativeStream

Namespace

Zend\Diactoros

Code

public function seek($offset, $whence = SEEK_SET) {
  if ($whence == SEEK_SET) {
    return $this->decoratedStream
      ->seek($offset + $this->offset, $whence);
  }
  return $this->decoratedStream
    ->seek($offset, $whence);
}