code: public function stream_write($data)
      {
          if (!$this->handle) {
              return false;
          }
          self::restorePrev();
          $length = \fwrite($this->handle, $data);
          self::register();
          return $length;
      }
docs: Write to stream
  
  @param string $data data to write
  
  @return integer
  
  @see http://php.net/manual/en/streamwrapper.stream-write.php