/**
  * @param $n
  *
  * @return string
  * @throws \RuntimeException
  * @throws \PhpAmqpLib\Exception\AMQPRuntimeException
  */
 protected function rawread($n)
 {
     if ($this->io) {
         $this->wait();
         $res = $this->io->read($n);
         $this->offset += $n;
     } else {
         if ($this->str_length < $n) {
             throw new AMQPRuntimeException("Error reading data. Requested {$n} bytes while string buffer has only " . $this->str_length);
         }
         $res = mb_substr($this->str, 0, $n, 'ASCII');
         $this->str = mb_substr($this->str, $n, mb_strlen($this->str, 'ASCII') - $n, 'ASCII');
         $this->str_length -= $n;
         $this->offset += $n;
     }
     return $res;
 }
Example #2
0
 /**
  * @return SocketIO
  */
 public function getSocket()
 {
     return $this->io->getSocket();
 }