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

Breadcrumb

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

function CachingStream::write

Overrides StreamDecoratorTrait::write

File

vendor/guzzlehttp/psr7/src/CachingStream.php, line 118

Class

CachingStream
Stream decorator that can cache previously read bytes from a sequentially read stream.

Namespace

GuzzleHttp\Psr7

Code

public function write($string) : int {
    // When appending to the end of the currently read stream, you'll want
    // to skip bytes from being read from the remote stream to emulate
    // other stream wrappers. Basically replacing bytes of data of a fixed
    // length.
    $overflow = strlen($string) + $this->tell() - $this->remoteStream
        ->tell();
    if ($overflow > 0) {
        $this->skipReadBytes += $overflow;
    }
    return $this->stream
        ->write($string);
}

API Navigation

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