Read data from the stream.
Binary-safe.

@param  integer $length Maximum number of bytes to read (default to buffer size).
@return string          The data.
171641
public function read($length = null)
    {
        $this->_ensureReadable();
        $length = $this->_bufferSize($length);
        if ($length <= 0) {
            return '';
        }
        $result = fread($this->_resource, $length);
        return $result === false ? '' : $result;
    }
464788
public function read(int $offset, int $length) {
        if ($this->swoole_buffer) {
            return $this->swoole_buffer->read($offset, $length);
        }
        return false;
    }
507620
public function read($length) : string
	{
		if (! \is_resource($this->resource))
		{
			throw new Exception\UnreadableStreamException('Stream is not resourceable');
		}

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

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

		if (false === $result)
		{
			throw new Exception\UnreadableStreamException('Unable to read from the stream');
		}

		return $result;
	}
100350
protected function readBytes($bytes)
    {
        $data = '';
        $len  = 0;

        while ($len < $bytes && !$this->eof()) {
            $d = fread($this->fp, $bytes-$len);
            if ($this->debug) {
                $this->debug('S: '. $d);
            }
            $data .= $d;
            $data_len = strlen($data);
            if ($len == $data_len) {
                break; // nothing was read -> exit to avoid apache lockups
            }
            $len = $data_len;
        }

        return $data;
    }
818674
final protected function fread($length = null)
	{
		if (! is_int($length)) {
			$length = $this->fstat('size');
		}
		return fread($this->fhandle, $length);
	}
38153
protected function read($length) {
		if ($this->length < $length) {
			throw new \Exception('Reading while at end of stream');
		}
		$output = substr($this->data, 0, $length);
		$this->data = substr($this->data, $length);
		$this->length -= $length;
		return $output;
	}
904687
public function read($length)
    {
        $pos = $this->stream->tell();
        $ret = $this->seekAndRead($length);
        $this->position += strlen($ret);
        $this->stream->seek($pos);
        if ($this->limit !== -1 && $this->position > $this->limit) {
            $ret = substr($ret, 0, -($this->position - $this->limit));
            $this->position = $this->limit;
        }
        return $ret;
    }
108362
public function readLine(int $length = 8192): string
    {
        return iconv($this->charset, 'UTF-8', $this->inputStream->readLine($length));
    }
1170666
public function stream_read($length)
    {
        if ($this->fileHandle === null) {
            return false;
        }
        self::restore();
        $content = fread($this->fileHandle, $length);
        self::register();
        return $content;
    }
802954
protected function readBinaryUnicodeString($length)
    {
      /* The problem is: we get the length of the string IN CHARACTERS;
         since a char in UTF-16 can be 16 or 32 bit long, we don't really know
         how long the string is in bytes */
        if (strlen($buff = substr($this->content, $this->pos, 2*$length)) != 2*$length) {
            throw IOException::readError("");
        }
        $this->pos += 2 * $length;

        if (!isset($this->uniqueTable[$buff])) {
            $this->uniqueTable[$buff] = true;
        }
        return new CFString(self::convertCharset($buff, "UTF-16BE", "UTF-8"));
    }
638385
public function readHex(int $length)
    {
        $value = Reader::high($this->bytes, 0, $length * 2);

        $this->skip($length);

        return $value;
    }
492971
protected function _fread($length = 1)
    {
        $returnValue = substr($this->_data, $this->_position, $length);
        $this->_position += $length;
        return $returnValue;
    }
542469
public final function read($length): string
   {
       if (!$this->isReadable()) {
           throw new RuntimeException("Can't read: stream is not readable");
       }
       $read = (string) fread($this->stream, (int) $length);
       $this->meta["eof"] = !$read ? true : false;
       return $read;
   }
224827
private function readToEndOfLine($length)
    {
        $str = $this->stream->read($length);
        if ($str === false || $str === '') {
            return $str;
        }
        while (substr($str, -1) !== "\n") {
            $chr = $this->stream->read(1);
            if ($chr === false || $chr === '') {
                break;
            }
            $str .= $chr;
        }
        return $str;
    }
254046
public function read($length){
        if(!is_int($length)){
            throw new \InvalidArgumentException();
        }

        if(null === $this->resource){
            throw new Exception\StreamUnavailableException(
                static::EXCEPTION_MSG_UNAVAILABLE
            );
        }

        if(!$this->isReadable()){
            throw new Exception\StreamUnreadableException(
                static::EXCEPTION_MSG_UNREADABLE
            );
        }

        if(false === ($contents = fread($this->resource, $length))){
            throw new \RuntimeException("Failed to read stream.");
        }

        return $contents;
    }
1316608
public function readBytes($length)
    {
        if (($length + $this->_needle) > $this->_streamLength) {
            require_once 'Zend/Amf/Exception.php';
            throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
        }
        $bytes = substr($this->_stream, $this->_needle, $length);
        $this->_needle+= $length;
        return $bytes;
    }
527668
protected function readBinaryData($length)
    {
        if ($length == 0) {
            $buff = "";
        } else {
            $buff = substr($this->content, $this->pos, $length);
            if (strlen($buff) != $length) {
                throw IOException::readError("");
            }
            $this->pos += $length;
        }

        return new CFData($buff, false);
    }