Reads exact $n bytes from buffer
@param  integer $n Number of bytes to read
@return string|false
437352
public function readExact($n)
    {
        if ($n === 0) {
            return '';
        }
        if (!$this->bev || $this->bev->input->length < $n) {
            return false;
        }
        return $this->read($n);
    }
129999
public function peek($n = 0)
    {
        $n += $this->pos;
        if (isset($this->input[$n])) {
            return $this->input[$n];
        }
        return null;
    }
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;
    }
197216
public function consumeSlice($n)
    {
        if ($this->length < $n) {
            throw new BufferUnderflowException();

        } elseif ($this->length === $n) {
            $buffer = $this->buffer;
            $this->buffer = "";
            $this->length = 0;
            return new Buffer($buffer);

        } else {
            $buffer = substr($this->buffer, 0, $n);
            $this->buffer = substr($this->buffer, $n);
            $this->length -= $n;
            return new Buffer($buffer);
        }
    }
663720
public function readDouble($offset = 0)
    {
        $s = $this->read(8, $offset);
        list(, $ret) = unpack("d", self::$isLittleEndian ? self::swapEndian64($s) : $s);
        return $ret;
    }
487475
public function read($bytesRequested)
    {
      $len = strlen($this->_sourceString);
      if($this->_bytesRead == $len) {
          return FALSE;
      } else if($bytesRequested > $len - $this->_bytesRead) {
          $bytesRequested = $len - $this->_bytesRead;
      }

      $buffer = substr($this->_sourceString, $this->_bytesRead, $bytesRequested);
      $this->_bytesRead += $bytesRequested;

      return $buffer;
    }
258314
public function read($len)
    {
        if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {
            $this->rBuf_ = $this->transport_->read($this->rBufSize_);
        }

        if (TStringFuncFactory::create()->strlen($this->rBuf_) <= $len) {
            $ret = $this->rBuf_;
            $this->rBuf_ = '';

            return $ret;
        }

        $ret = TStringFuncFactory::create()->substr($this->rBuf_, 0, $len);
        $this->rBuf_ = TStringFuncFactory::create()->substr($this->rBuf_, $len);

        return $ret;
    }
721059
protected function _rawread($n)
    {
        if ($this->_bufferedInput) {
            $result = '';
            $read = 0;
            while ($read < $n && !feof($this->_bufferedInput->realSock()) &&
                   (false !== ($buffer = fread($this->_bufferedInput->realSock(), $n - $read)))
            ) {
                // get status of socket to determine whether or not it has timed out
                $info = stream_get_meta_data($this->_bufferedInput->realSock());
                if($info['timed_out']) {
                    throw new \Exception('Error reading data. Socket connection timed out');
                }

                $read += strlen($buffer);
                $result .= $buffer;
            }

            if (strlen($result) != $n) {
                throw new \Exception(
                    sprintf(
                            'Error reading data. Recevived %d instead of '.
                            'expected %d bytes', strlen($result), $n
                         )
                    );
            }

            $this->_offset += $n;
        } else {
            if (strlen($this->_str) < $n) {
                throw new \Exception(
                    sprintf(
                        'Error reading data. Requested %d bytes while string '.
                        'buffer has only %s', $n, strlen($this->_str)
                    )
                );
            }
            $result = substr($this->_str, 0, $n);
            $this->_str = substr($this->_str, $n);
            $this->_offset += $n;
        }
        return $result;
    }
874007
public function read($size = 8192)
    {
        $buf = @fread($this->sock, $size);
        if ($buf === '' || $buf === false) {
            $buf = $this->ioEmptyError() ? false : null;
        }
        $this->ioFlagReset();
        return $buf;
    }
564452
public static function readShortInt(&$buffer)
    {
        $tmp = unpack('n', $buffer);
        $buffer = substr($buffer, 2);
        return array_pop($tmp);
    }
526203
public function numToAlpha($n)
  {
    for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) {
      $r = chr($n%26 + 0x61) . $r;
    }
    return $r;
  }
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);
  }
685427
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);
        $matched = [];

        $regexpsSize = count($this->_regexps);
        foreach ($lines as $line) {
            for ($i = 0; $i < $regexpsSize; $i++) {
                $regexp = $this->_regexps[$i];
                $re = $regexp->getRegexp($this->getProject());
                $re->setIgnoreCase(!$this->casesensitive);
                $matches = $re->matches($line);
                if (!$matches) {
                    $line = null;
                    break;
                }
            }
            if ($line !== null) {
                $matched[] = $line;
            }
        }
        $filtered_buffer = implode("\n", $matched);

        if ($this->isNegated()) {
            $filtered_buffer = implode("\n", array_diff($lines, $matched));
        }

        return $filtered_buffer;
    }
1197532
public long readNBit(int n) throws IOException {
        if (n > 64)
            throw new IllegalArgumentException("Can not readByte more then 64 bit");

        long val = 0;

        for (int i = 0; i < n; i++) {
            val <<= 1;
            val |= read1Bit();
        }

        return val;
    }
75891
public static byte[] readbytes(InputStream input, int n) throws IOException {
		byte[] buffer = new byte[n];
		readbytes_into(input, buffer, 0, n);
		return buffer;
	}
13415
public function getSigFigs($n)
    {
        $n = ltrim($n, '0+-');
        $dp = strpos($n, '.'); // decimal position
        if ($dp === false) {
            $sigfigs = strlen(rtrim($n, '0'));
        } else {
            $sigfigs = strlen(ltrim($n, '0.')); // eliminate extra decimal character
            if ($dp !== 0) {
                $sigfigs--;
            }
        }
        return $sigfigs;
    }
1070509
public function skip(int $n) : int
    {
        if ($n <= 0) {
            return 0;
        }

        $skipped = 0;
        $skipLimit = min(self::MAX_SKIP_BUFFER_SIZE, $n);
        while ($skipped < $n) {
            $buf = $this->read(min($skipLimit, $n - $skipped));
            if ($buf === null) {
                break;
            }
            $skipped += strlen($buf);
        }
        return $skipped;
    }