Read some data into the array.

@param int $len How much to read
@return string The data that has been read
@throws TTransportException if cannot read any more data
328388
public function read($len)
    {
        $data = @fread($this->handle_, $len);
        if ($data === false || $data === '') {
            $md = stream_get_meta_data($this->handle_);
            if ($md['timed_out']) {
                throw new TTransportException(
                    'THttpClient: timed out reading ' . $len . ' bytes from ' .
                    $this->host_ . ':' . $this->port_ . $this->uri_,
                    TTransportException::TIMED_OUT
                );
            } else {
                throw new TTransportException(
                    'THttpClient: Could not read ' . $len . ' bytes from ' .
                    $this->host_ . ':' . $this->port_ . $this->uri_,
                    TTransportException::UNKNOWN
                );
            }
        }

        return $data;
    }
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;
    }
853532
public function read($n) {
    if ($n < 1) {
      return "";
    }

    $string = fread($this->f, $n);
    $chunks = str_split($string, 2);
    $chunks = array_map("strrev", $chunks);

    return implode("", $chunks);
  }
253315
public function read($len = null)
    {
        if (!class_exists('XSLTProcessor')) {
            throw new BuildException("Could not find the XSLTProcessor class. Make sure PHP has been compiled/configured to support XSLT.");
        }

        if ($this->processed === true) {
            return -1; // EOF
        }

        if (!$this->getInitialized()) {
            $this->_initialize();
            $this->setInitialized(true);
        }

        // Read XML
        $_xml = null;
        while (($data = $this->in->read($len)) !== -1) {
            $_xml .= $data;
        }

        if ($_xml === null) { // EOF?

            return -1;
        }

        if (empty($_xml)) {
            $this->log("XML file is empty!", Project::MSG_WARN);

            return ''; // return empty string, don't attempt to apply XSLT
        }

        // Read XSLT
        $_xsl = null;
        $br = new BufferedReader(new FileReader($this->xslFile));
        $_xsl = $br->read();

        $this->log(
            "Tranforming XML " . $this->in->getResource() . " using style " . $this->xslFile->getPath(),
            Project::MSG_VERBOSE
        );

        $out = '';
        try {
            $out = $this->process($_xml, $_xsl);
            $this->processed = true;
        } catch (IOException $e) {
            throw new BuildException($e);
        }

        return $out;
    }
446406
public function read($len = null)
    {
        $this->_initialize();

        // Process whole text at once.
        $text = null;
        while (($data = $this->in->read($len)) !== -1) {
            $text .= $data;
        }

        // At the end.
        if (null === $text) {
            return -1;
        }

        $this->log(
            "Encoding " . $this->in->getResource() . " from " . $this->getInputEncoding() . " to " . $this->getOutputEncoding(),
            Project::MSG_VERBOSE
        );

        return iconv($this->_inputEncoding, $this->_outputEncoding, $text);
    }
307551
private function read($bytes)
    {
        $read = '';
        $total = $bytes;

        while (!$this->isEndOfFile() && $bytes) {
            if (false === ($chunk = @fread($this->getHandle(), $bytes))) {
                $error = error_get_last();

                throw new RuntimeException($error['message']);
            }

            $read .= $chunk;
            $bytes -= strlen($chunk);
        }

        if ($total !== ($actual = strlen($read))) {
            throw new RuntimeException(
                "Only read $actual bytes of $total from \"{$this->file}\"."
            );
        }

        return $read;
    }
751787
public int readN(final byte[] abuf, final int off, final int len)
            throws OtpErlangDecodeException {
        if (len == 0 && available() == 0) {
            return 0;
        }
        final int i = super.read(abuf, off, len);
        if (i < 0) {
            throw new OtpErlangDecodeException("Cannot read from input stream");
        }
        return i;
    }
345740
public function read($len = null)
    {
        if ($this->eof()) {
            return -1;
        }

        if ($len === null) { // we want to keep reading until we get an eof
            $out = "";
            while (!$this->eof()) {
                $out .= fread($this->stream, 8192);
                $this->currentPosition = ftell($this->stream);
            }
        } else {
            $out = fread($this->stream, $len); // adding 1 seems to ensure that next call to read() will return EOF (-1)
            $this->currentPosition = ftell($this->stream);
        }

        return $out;
    }
968919
public function read($len) {
        // Do a non-blocking read to clear any buffering, even though
        // the code doesn't use the results
        if (is_resource($this->socket_)) {
            @fread($this->socket_, max($len, 8192));
        }

        // Return data from the hard-coded response buffer
        $part = substr($this->respBuffer_, 0, $len);
        $this->respBuffer_ = substr($this->respBuffer_, $len);
        return $part;
    }
727253
public byte[] read(int len) throws SQLException {
    // This is the original method, where the entire block (len bytes)
    // is retrieved in one go.
    FastpathArg[] args = new FastpathArg[2];
    args[0] = new FastpathArg(fd);
    args[1] = new FastpathArg(len);
    return fp.getData("loread", args);
  }
859570
public function read($length)
    {
        $buffer = $this->socket->read($length);

        if ($this->state < self::STATE_OPEN) {
            $this->handshakeBuffer .= $buffer;

            $headerPos = mb_strpos(
                $this->handshakeBuffer,
                "\r\n\r\n",
                0,
                '8bit'
            );

            if ($headerPos !== false) {
                $data = mb_substr(
                    $this->handshakeBuffer,
                    0,
                    $headerPos,
                    '8bit'
                );

                try {
                    $this->handleHandshake($data);
                } catch (Net_Notifier_WebSocket_ProtocolException $e) {
                    $this->state = self::STATE_CLOSED;
                    $this->shutdown();
                }

                $length = mb_strlen($this->handshakeBuffer, '8bit');
                $buffer = mb_substr(
                    $this->handshakeBuffer,
                    $headerPos + 4,
                    $length - $headerPos - 5,
                    '8bit'
                );
            }
        }

        if ($this->state > self::STATE_CONNECTING) {
            $frames = $this->parser->parse($buffer);

            foreach ($frames as $frame) {
                $this->handleFrame($frame);
            }
        }

        return (
               count($this->textMessages) > 0
            || count($this->binaryMessages) > 0
        );
    }
1353111
public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->_initialize();
            $this->setInitialized(true);
        }

        $buffer = $this->in->read($len);

        if ($buffer === -1) {
            return -1;
        }

        $lines = explode("\n", $buffer);
        $filtered = [];

        foreach ($lines as $line) {
            $line = $this->_prefix . $line;
            $filtered[] = $line;
        }

        $filtered_buffer = implode("\n", $filtered);

        return $filtered_buffer;
    }
1012027
public function read($length)
    {
        if ($this->isOpen() === false) {
            $msg = "Cannot read from a closed MemoryStream.";
            throw new MemoryStreamAccess($msg, $this, MemoryStreamException::NOT_OPEN);
        }
        
        if ($length === 0) {
            return '';
        }

        $position = $this->position;
        $finalPosition = $position + $length;

        if ($finalPosition > $this->length) {
            $msg = "Cannot read outside the bounds of the MemoryStream.";
            throw new MemoryStreamException($msg, $this, MemoryStreamException::READ);
        }

        $this->incrementPosition($length);

        $returnValue = '';

        while ($position < $finalPosition) {
            $returnValue .= $this->binary[$position];
            $position++;
        }

        return $returnValue;
    }
223879
public function read($len)
    {
        // happy path to return empty string for zero length string
        if ($len === 0) {
            return '';
        }

        // happy path for single byte strings without using substrings
        if ($len === 1 && isset($this->buffer[$this->bufferPos])) {
            return $this->buffer[$this->bufferPos++];
        }

        // ensure buffer size contains $len bytes by checking target buffer position
        if ($len < 0 || !isset($this->buffer[$this->bufferPos + $len - 1])) {
            throw new \LogicException('Not enough data in buffer to read ' . $len . ' bytes');
        }
        $buffer = \substr($this->buffer, $this->bufferPos, $len);
        $this->bufferPos += $len;

        return $buffer;
    }
435321
protected function readBuffer($n)
    {
        $n = min($n, strlen($this->buffer) - $this->offset);
        if ($n === 0) {
            // substr('', 0, 0) => false, which screws up read loops that are
            // expecting non-blocking reads to return ''. This avoids that edge
            // case when the buffer is empty/used up.
            return '';
        }
        $block = substr($this->buffer, $this->offset, $n);
        $this->offset += $n;
        return $block;
    }
485891
public function read($limit = 5)
    {
        $read = Auth::user()->notifications()->whereNotNull('read_at')->take($limit)->get();

        return $read->map(function ($item) {
            return $this->toCollect($item);
        });
    }
948276
protected function pad($string, $len)
    {
        $strlen = $this->strlen($string);
        if ($strlen > $len) return $string;

        $pad = $len - $strlen;
        return $string . str_pad('', $pad, ' ');
    }