/** * {@inheritDoc} */ public final function writeTo(&$target, int $bufferSize = 1024) : IString { if (null === $target) { throw new ArgumentNullException('target'); } if ($bufferSize < 1) { throw new ArgumentOutOfRangeException($bufferSize, 'bufferSize'); } if ($target instanceof IString) { $target = $target->append($this->_wrappedValue); } else { static::using(function (IStream $src, IStream $dest, int $buffSize) { $src->copyTo($dest, $buffSize); }, new MemoryStream($this->_wrappedValue), Stream::asStream($target), $bufferSize); } return $this; }