Exemple #1
0
 /**
  * Read a long from the socket.
  *
  * @return int the integer read
  */
 protected function _readLong()
 {
     $this->_input_buffer .= $_read = $this->_socket->read(8);
     return Reader::unpackLong($_read);
 }
Exemple #2
0
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Offset to retrieve
  * @link http://php.net/manual/en/arrayaccess.offsetget.php
  *
  * @param mixed $offset <p>
  *                      The offset to retrieve.
  *                      </p>
  *
  * @todo add support for Tree Based RidBags
  * @return ID The RecordID instance at the given offset.
  */
 public function offsetGet($offset)
 {
     if (isset($this->items[$offset])) {
         return $this->items[$offset];
     }
     if ($this->type === self::EMBEDDED) {
         $start = $this->baseOffset + $offset * 10;
         $chunk = substr($this->binaryContent, $start, 2);
         if ($chunk === false) {
             $this->items[$offset] = false;
             return $this->items[$offset];
         }
         $cluster = Reader::unpackShort(substr($this->binaryContent, $start, 2));
         $position = Reader::unpackLong(substr($this->binaryContent, $start + 2, 8));
         $this->items[$offset] = new ID($cluster, $position);
     } else {
         $this->items[$offset] = false;
     }
     return $this->items[$offset];
 }