Example #1
0
 protected function readHeader(MemStream $s)
 {
     // check header
     $s->serial_buffer($hskp, 4);
     if ($hskp !== self::HEADER) {
         throw new \RuntimeException('Wrong packed sheets header, expected "' . self::HEADER . '"');
     }
     $s->serial_uint32($header_version);
     if ($header_version != self::HEADER_VERSION) {
         throw new \RuntimeException('Wrong packed sheets version, expected "' . self::HEADER_VERSION . '", got "' . $header_version . '"');
     }
     $s->serial_byte($this->compat);
     $s->serial_uint32($dependBlockSize);
     if ($this->skipDependBlock) {
         // skip dependency block
         $pos = $s->getPos();
         $s->seek($pos + $dependBlockSize);
     } else {
         // read dictionary
         $s->serial_uint32($nb);
         $s->serial_int_string($this->dictionnary, $nb);
         // read dependency data
         $this->dependencies = array();
         $s->serial_uint32($depSize);
         for ($i = 0; $i < $depSize; $i++) {
             $s->serial_uint32($sheetId);
             $s->serial_uint32($nb);
             $s->serial_uint32($this->dependencies[$sheetId], $nb);
         }
     }
 }