Return a StreamWriter

@return \Protobuf\Binary\StreamWriter
484699
public function getStreamWriter()
    {
        if ($this->streamWriter !== null) {
            return $this->streamWriter;
        }

        return $this->streamWriter = new StreamWriter($this);
    }
126367
protected function createAsAvailable(): XmlStreamWriter
    {
        foreach (array_keys($this->types) as $xmlExtension) {
            if (extension_loaded($xmlExtension)) {
                return $this->createStreamWriter($xmlExtension);
            }
        }

        throw new XmlException(
                'No supported xml extension available, can not create a xml stream writer!'
        );
    }
140165
public function stream_write($data) {
    assert(isset($this->client));
    return $this->client->write($data);
  }
509582
public function detach()
    {
        $resource = $this->resource;

        $this->resource = null;
        $this->stream = null;
        $this->pointer = 0;
        $this->seekable = true;
        $this->writable = true;

        return $resource;
    }
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);
	}
322378
public function createWriteContext()
    {
        $stream      = Stream::create();
        $writer      = $this->getStreamWriter();
        $sizeContext = $this->createComputeSizeContext();
        $context     = new WriteContext($stream, $writer, $sizeContext);

        return $context;
    }
19921
public static function stream($body = null): StreamInterface
    {
        if ($body instanceof StreamInterface) {
            return $body;
        }

        if (\is_resource($body)) {
            return new Stream($body);
        }

        $resource = \fopen('php://temp', 'rw+b');
        $stream = new Stream($resource);
        if ($body) {
            $stream->write($body);
        }

        return $stream;
    }
792159
private function getOutputWriter()
    {
        if ($this->useFile) {
            $of = $this->getOutfile();
            if (!$of) {
                $of = new PhingFile($this->formatter->getPreferredOutfile());
            }

            return new FileWriter($of, $this->append);
        } else {
            return $this->getDefaultOutput();
        }
    }
190926
protected function getMonologHandler()
  {
    $name = Str::slug($this->getNamespaceName());
    return (new StreamHandler($this->storagePath("logs/{$name}.log"), Logger::DEBUG))
      ->setFormatter(new LineFormatter(null, null, true, true));
  }
1297672
public function getBody()
    {
        $streamResource = fopen('php://memory', 'r+');
        if (is_resource($this->content)) {
            stream_copy_to_stream($this->content, $streamResource);
        } else {
            fwrite($streamResource, $this->content);
        }
        rewind($streamResource);

        return new ContentStream($streamResource);
    }
980833
public function getBody()
    {
        if (!($this->body instanceof StreamInterface)) {
            $this->body = new Stream(Stream::createResourceTemp());
        }

        return $this->body;
    }
124792
private function getTokenStream(): TokenStream
    {
        if (null === $this->tokens) {
            $this->tokens = new TokenStream(file_get_contents($this->filename));
        }

        return $this->tokens;
    }
570872
public function getBody()
    {
        if ($this->stream === null) {
            ob_start();
            $this->htmlElement->toHtml();
            $content = ob_get_clean();
            $this->stream = new Stream('php://memory', 'wb+');
            $this->stream->write($content);
        }

        return $this->stream;
    }
998583
public static function create()
    {
        $dispatcher = new Dispatcher();
        foreach (static::$_stack as $middleware) {
            $dispatcher->addFilter($middleware);
        }

        return $dispatcher;
    }
782351
public function getIterator()
    {
        if ($this->_result === false) {
            return new \EmptyIterator();
        }

        if (!isset($this->_iterator)) {
            $this->_iterator = new ResultIterator($this->_result);
            $this->_iterator->setHydrator($this->_hydrator);
        }

        return $this->_iterator;
    }
85874
protected function batchFactory()
    {
        return new WriteBatch(
            $this->connection,
            $this->valueMapper,
            $this->databaseFromName($this->name)
        );
    }
1083242
public function getStream()
    {
        if ($this->stream === null) {
            return $this->streamFactory->newMessagePartStream($this);
        }
        $this->stream->rewind();
        return $this->stream;
    }