Write some $data in the stream.

@param string $data
14561
public function write($data)
    {
        if ($this->isOpen() === false) {
            $msg = "Cannot write in a closed MemoryStream.";
            throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
        }
        
        if ($this->length - 1 === $this->position) {
            // simply append.
            $this->binary .= $data;
        } elseif ($this->position === 0) {
            // simply prepend.
            $this->binary = ($data . $this->binary);
        } else {
            // we are in the middle of the string.
            $part1 = substr($this->binary, 0, $this->position);
            $part2 = substr($this->binary, $this->position);
            $this->binary = ($part1 . $data . $part2);
        }

        $dataLen = strlen($data);
        $this->incrementPosition($dataLen);
        $this->incrementLength($dataLen);

        return $dataLen;
    }
509014
function put($data)
    {
        if ($this->_change == self::STATE_INSERT)
        {
            $this->_change = self::STATE_UPDATE;
            $this->_update = $data;
        }
        elseif ($this->_change == self::STATE_EMPTY)
        {
            $this->_change = self::STATE_INSERT;
            $this->_data = $data;
        }
    }
726820
public function stream_write($data)
    {
        $tmp = &$this->_data[$this->_datapos];

        $oldlen = $tmp['l'];
        $res = fwrite($tmp['fp'], $data);
        if ($res === false) {
            return false;
        }

        $tmp['p'] = ftell($tmp['fp']);
        if ($tmp['p'] > $oldlen) {
            $tmp['l'] = $tmp['p'];
            $this->_length += ($tmp['l'] - $oldlen);
        }

        return $res;
    }
1100029
private function writeData($data) {
        $count = fwrite($this->connection, $data.EOL_WINDOWS, strlen($data)+2);

        if ($count != strlen($data)+2)
            throw new RuntimeException('Error writing to socket, length of data: '.(strlen($data)+2).', bytes written: '.$count.NL.'data: '.$data.NL.NL.'SMTP transfer log:'.NL.'------------------'.NL.$this->logBuffer);

        $this->logSentData($data);
    }
609848
public function setData($data)
    {
        if (!is_string($data)) {
            $data = json_encode($data);
        }

        $this->data = $data;
    }
922449
public void write(byte[] data) {
        for(int i=0;i<data.length;i++) {
            writeByte(data[i]);
        }
    }
1247774
public function write(string $data) : void
    {
        if ($this->closed) {
            throw new IoException('The stream is closed.');
        }

        try {
            $result = ErrorCatcher::run(function() use ($data) {
                return fwrite($this->handle, $data);
            });
        } catch (\ErrorException $e) {
            throw new IoException($e->getMessage(), 0, $e);
        }

        if ($result === false) {
            throw new IoException('Failed to write to stream.');
        }
    }
421340
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write($data);
    }
406332
public function stream_write($data)
    {
        if (! $this->temporaryFileHandle) {
            return 0;
        }
        
        $len = strlen($data);
        fwrite($this->temporaryFileHandle, $data, $len);
        return $len;
    }
1072217
public function stream_write($data)
	{
		$left = substr($this->buffers[$this->name], 0, $this->position);
		$right = substr($this->buffers[$this->name], $this->position + strlen($data));
		$this->buffers[$this->name] = $left . $data . $right;
		$this->position += strlen($data);

		return strlen($data);
	}
1335220
public function write($data)
    {
        if (!$this->connected) {
            if (!$this->connect()) {
                return false;
            }
        }
        return fwrite($this->connection, $data, strlen($data));
    }
172417
public function write(string $data): void
	{
		if ($this->connected() === false)
		{
			throw new \Exception('Not connected');
		}

		fwrite($this->connection, $data);
	}
1324206
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write_buffer->bufferWrite(@$this->encrypt->encrypt($data));
    }
971075
public function write($data)
    {
        $this->contentLength += strlen($data);
        $this->data .= $data;

        return $this;
    }
130207
public function setData($data)
    {
        foreach($this->data as $args)
        {
            Event::off(...$args);
        }
        $this->data = $data;
        foreach($this->data as $args)
        {
            Event::on(...$args);
        }
    }
265598
public function write($data)
    {
        //encrypt the data if needed
        if($this->secret !== null) {
            mcrypt_generic_init($this->encryptor, $this->secret, $this->secret);
            $data = mcrypt_generic($this->encryptor, $data);
            mcrypt_generic_deinit($this->encryptor);
        }
        return parent::write($data);
    }
929951
public function write($bytes)
    {
        $this->out += strlen($bytes);
        foreach ($this->mirrors as $stream) {
            $stream->write($bytes);
        }
    }