@see Swift_CharacterStream::read()

@param int $length

@return string
320981
public function read($length)
    {
        if ($this->currentPos >= $this->charCount) {
            return false;
        }
        $ret = false;
        $length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length;
        switch ($this->mapType) {
            case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
                $len = $length * $this->map;
                $ret = substr($this->datas,
                        $this->currentPos * $this->map,
                        $len);
                $this->currentPos += $length;
                break;

            case Swift_CharacterReader::MAP_TYPE_INVALID:
                $ret = '';
                for (; $this->currentPos < $length; ++$this->currentPos) {
                    if (isset($this->map[$this->currentPos])) {
                        $ret .= '?';
                    } else {
                        $ret .= $this->datas[$this->currentPos];
                    }
                }
                break;

            case Swift_CharacterReader::MAP_TYPE_POSITIONS:
                $end = $this->currentPos + $length;
                $end = $end > $this->charCount ? $this->charCount : $end;
                $ret = '';
                $start = 0;
                if ($this->currentPos > 0) {
                    $start = $this->map['p'][$this->currentPos - 1];
                }
                $to = $start;
                for (; $this->currentPos < $end; ++$this->currentPos) {
                    if (isset($this->map['i'][$this->currentPos])) {
                        $ret .= substr($this->datas, $start, $to - $start).'?';
                        $start = $this->map['p'][$this->currentPos];
                    } else {
                        $to = $this->map['p'][$this->currentPos];
                    }
                }
                $ret .= substr($this->datas, $start, $to - $start);
                break;
        }

        return $ret;
    }
173550
public function read(int $length): string
    {
        $data = @fread($this->handle, $length);

        if (false === $data || '' === $data) {
            $message = 'Could not read from the file.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return $data;
    }
592515
public static function read($source, $length = 0)
    {
        if (!is_file($source) || !is_readable($source)) {
            return false;
        }
        try {
            if ($length <= 0 || $length > filesize($source)) {
                return file_get_contents($source);
            }

            $file = @fopen($source, 'r');
            $content = @fread($file, $length);
            @fclose($file);
            return $content;
        } catch (\Exception $e) {
            return false;
        }
    }
202814
public function read($length)
    {
        $buffer = '';
        $total = count($this->streams) - 1;
        $remaining = $length;
        $progressToNext = false;

        while ($remaining > 0) {

            // Progress to the next stream if needed.
            if ($progressToNext || $this->streams[$this->current]->eof()) {
                $progressToNext = false;
                if ($this->current === $total) {
                    break;
                }
                $this->current++;
            }

            $result = $this->streams[$this->current]->read($remaining);

            // Using a loose comparison here to match on '', false, and null
            if ($result == null) {
                $progressToNext = true;
                continue;
            }

            $buffer .= $result;
            $remaining = $length - strlen($buffer);
        }

        $this->pos += strlen($buffer);

        return $buffer;
    }
1039219
public function seekAndRead($length)
    {
        $this->stream->seek($this->offset + $this->position);
        if ($this->limit !== -1) {
            $length = min($length, $this->limit - $this->position);
            if ($length <= 0) {
                return '';
            }
        }
        return $this->stream->read($length);
    }
462490
public function readfunction($curl, $stream, int $length):string{
		return $this->request->getBody()->read($length);
	}
758250
public function read($length)
    {
        if ($length < 0) {
            throw new DomainAssertion('Length cannot be negative');
        }
        if ($length == 0) {
            return '';
        }
        $this->checkStreamAvailable();
        return fread($this->fileDescriptor, $length);
    }
78672
public function getReadBuffer(&$length): Promise
    {
        $size = fstat($this->memory_stream)['size'];
        $offset = ftell($this->memory_stream);
        $length = $size - $offset;
        if ($length === 0 || $size > self::MAX_SIZE) {
            $new_memory_stream = fopen('php://memory', 'r+');
            if ($length) {
                fwrite($new_memory_stream, fread($this->memory_stream, $length));
                fseek($new_memory_stream, 0);
            }
            fclose($this->memory_stream);
            $this->memory_stream = $new_memory_stream;
        }

        return new \Amp\Success($this);
    }
1025942
public function read($length)
    {
        $index = 0;
        $contents = '';
        while ($this->iterator->valid() && $index < $length) {
            if ($this->stringify !== null) {
                $contents .= $this->stringify->call($this, $this->iterator->current());
            } else {
                $contents .= $this->iterator->current();
            }

            $this->iterator->next();
            ++$this->position;
            ++$index;
        }

        return $contents;
    }
665285
public function read($length)
    {
        if (!$this->handle) $this->open('r');
        return $this->fs->fread($this->handle, $length);
    }
16619
static function read($fp,$length)
    {
        $data = '';
        while($buf = fread($fp, $length))
        {
            $data .= $buf;
            if(strlen($buf) < $length) break;
        }
        return $data;
    }
1071617
public function read($length = self::DEFAULT_LENGTH)
		{
			$bytes = dio_read($this->serial, $length);
			return $bytes;
		}
412488
public function read($length = 0, $asArray = false)
    {
        if ($asArray &&
            Number::isZero($length)) {

            return file($this->file);
        } elseif (Number::isPositive($length)) {
            $this->setHandle('r');

            return fread($this->handle, $length);
        } else {
            return Collection::implode($this->read(0, true), '');
        }
    }
638385
public function readHex(int $length)
    {
        $value = Reader::high($this->bytes, 0, $length * 2);

        $this->skip($length);

        return $value;
    }
1319845
public function read($length)
	{
		$read = 0;
		$parts = array();

		while ($read < $length && !$this->_wrapper()->feof($this->_socket))
		{
			$data = $this->_wrapper()
				->fread($this->_socket, $length - $read);

			if ($data === false)
			{
				throw new Pheanstalk_Exception_SocketException('fread() returned false');
			}

			$read += strlen($data);
			$parts []= $data;
		}

		return implode($parts);
	}
64936
public function read($length)
    {
        // let Guzzle decide what to do.
        if ($length <= 0 || $this->eof()) {
            return $this->stream->read($length);
        }
        $this->fillBuffer($length);
        $read = $this->buffer->read($length);
        $this->position += strlen($read);
        return $read;
    }
700089
protected function readBinaryString($length)
    {
        if ($length == 0) {
            $buff = "";
        } else {
            if (strlen($buff = substr($this->content, $this->pos, $length)) != $length) {
                throw IOException::readError("");
            }
            $this->pos += $length;
        }

        if (!isset($this->uniqueTable[$buff])) {
            $this->uniqueTable[$buff] = true;
        }
        return new CFString($buff);
    }