&readBuffer

@param int $length
@return mixed
9020
public function &readBuffer($length) {

            if ($length+$this->cursor > strlen($this->rawData)) {
                throw new Exception('Buffer underrun at position: '. $this->cursor . '. Trying to fetch '. $length . ' bytes');
                return false;
            }
            $data = substr($this->rawData,$this->cursor,$length);
            $this->cursor+=$length;
            return $data;

        }
682504
public function readStream($length)
    {
        $stream  = self::fromString();
        $target  = $stream->stream;
        $source  = $this->stream;

        if ($length < 1) {
            return $stream;
        }

        $written = stream_copy_to_stream($source, $target, $length);

        if ($written !== $length) {
            throw new RuntimeException('Failed to read stream with ' . $length . ' bytes');
        }

        $stream->seek(0);

        return $stream;
    }
904836
public function read($length)
    {
        if ($this->deadline) {
            stream_set_timeout($this->socket, max($this->deadline - time(), 1));
        }

        // Note: For correct behaviour, $length should be the same at the
        // PHP stream chunk size. For all PHP < 5.4 this is 8192. Other values
        // will cause PHP's internal stream buffer to be used and break
        // stream_select() semantics. See https://bugs.php.net/bug.php?id=52602
        $data = fread($this->socket, $length);

        $this->checkTimeout();
        return $data;
    }
1112728
public function read($length = null) {

            if(is_null($length))
                $length = $this->getSize(0);

            if (!$this->isReadable() || ($data = fread($this->stream, $length)) === false) {
                throw new \RuntimeException('Could not read from not readable stream');
            }

            return $data;

        }
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;
	}
1235598
public function write($buffer, $length = 0)
    {
        if ("\n" != substr($buffer, -1)) {
            $buffer .= "\n";
        }
        if (!$length) {
            $length = strlen($buffer);
        }

        return socket_write($this->socket, $buffer, $length);
    }
1103722
public function readLine(int $length = 8192): string
    {
        $bytes        = substr($this->buffer, $this->position, $length);
        $linebreakpos = strpos($bytes, "\n");
        if (false !== $linebreakpos) {
            $line = substr($bytes, 0, $linebreakpos);
            $this->position += strlen($line) + 1;
        } else {
            $line = $bytes;
            $this->position += strlen($line);
        }

        return rtrim($line);
    }
141144
private function readRawCharsIntoBuffer($length)
    {
        $n = $length + 32;
        while ($this->bufferLength < $n) {
            $raw = $this->stream->read($n + 512);
            if ($raw === false || $raw === '') {
                return;
            }
            $this->buffer .= $raw;
            $this->bufferLength = $this->converter->getLength($this->buffer, $this->streamCharset);
        }
    }
1213418
public function read($length)
    {
        // let Guzzle decide what to do.
        if ($length <= 0 || $this->eof()) {
            return $this->stream->read($length);
        }
        $this->readRawCharsIntoBuffer($length);
        $numChars = min([$this->bufferLength, $length]);
        $chars = $this->converter->getSubstr($this->buffer, $this->streamCharset, 0, $numChars);
        
        $this->position += $numChars;
        $this->buffer = $this->converter->getSubstr($this->buffer, $this->streamCharset, $numChars);
        $this->bufferLength = $this->bufferLength - $numChars;

        return $this->converter->convert($chars, $this->streamCharset, $this->stringCharset);
    }
838131
public function read($length)
    {
        $buffer = '';
        $total = count($this->streams) - 1;
        $remaining = $length;

        while ($remaining > 0) {
            // Progress to the next stream if needed.
            if ($this->streams[$this->current]->eof()) {
                if ($this->current == $total) {
                    break;
                }
                $this->current++;
            }
            $buffer .= $this->streams[$this->current]->read($remaining);
            $remaining = $length - strlen($buffer);
        }

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

        return $buffer;
    }
979454
public function readBinary(int $length = 1024): string
    {
        $data = fread($this->resource, $length);
        if (false === $data) {
            if (stream_get_meta_data($this->resource)['timed_out']) {
                throw new Timeout(
                        'Reading of ' . $length . ' bytes failed: timeout of '
                        . $this->timeout . ' seconds exceeded'
                );
            }

            throw new ConnectionFailure(
                    'Reading of ' . $length . ' bytes failed.'
            );
        }

        return $data;
    }
1227893
protected function readBinaryReal($length)
    {
        if ($length > 3) {
            throw new PListException("Real greater than 8 bytes: $length");
        }

        $nbytes = 1 << $length;
        $val = null;
        if (strlen($buff = substr($this->content, $this->pos, $nbytes)) != $nbytes) {
            throw IOException::readError("");
        }
        $this->pos += $nbytes;

        switch ($length) {
            case 0: // 1 byte float? must be an error
            case 1: // 2 byte float? must be an error
                $x = $length + 1;
                throw new PListException("got {$x} byte float, must be an error!");
            case 2:
                $val = unpack("f", strrev($buff));
                $val = $val[1];
                break;
            case 3:
                $val = unpack("d", strrev($buff));
                $val = $val[1];
                break;
        }

        return new CFNumber($val);
    }
818674
final protected function fread($length = null)
	{
		if (! is_int($length)) {
			$length = $this->fstat('size');
		}
		return fread($this->fhandle, $length);
	}
1274223
public function bufferRead(int $length): Promise
    {
        if ($this->read_hash === null) {
            return $this->read_buffer->bufferRead($length);
        }

        return call([$this, 'bufferReadAsync'], $length);
    }
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;
    }
105225
public function readFileLine($length = null)
    {
        $this->openFile();
        //gets warning "fgets(): Length parameter must be greater than 0" when parameter is null and is passed to function
        if($length === null)
        {
            $line = fgets($this->getFile());
        }
        else
        {
            $line = fgets($this->getFile(), $length);
        }

        return $line;
    }
263493
public function read($offset, $length = 1)
    {
        $ret = '';
        $segno = floor($offset / $this->segsize);
        $sOffset = $offset % $this->segsize;
        while (true) {
            if (!isset($this->segments[$segno])) {
                if (!$this->open($segno)) {
                    goto ret;
                }
            }

            $ret .= shmop_read($this->segments[$segno], $sOffset, min($length - mb_orig_strlen($ret), $this->segsize));

            if (mb_orig_strlen($ret) >= $length) {
                goto ret;
            }

            ++$segno;

            $sOffset = 0;
        }
        ret:

        return $ret === '' ? false : $ret;
    }