• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/web/http/stream.php
  • Класс: Bitrix\Main\Web\Http\Stream
  • Вызов: Stream::read
public function read(int $length): string
{
	if (!$this->resource)
	{
		throw new \RuntimeException('No resource available, cannot read.');
	}

	if (!$this->isReadable())
	{
		throw new \RuntimeException('Stream is not readable.');
	}

	$result = fread($this->resource, $length);

	if ($result === false)
	{
		throw new \RuntimeException('Error reading stream.');
	}

	return $result;
}