Exemple #1
0
 /**
  * Reads the offset table from the given stream.
  *
  * @param StreamInterface $stream The stream to read from.
  */
 public function read(StreamInterface $stream)
 {
     $this->tag = $stream->readULong();
     $this->checksum = $stream->readULong();
     $this->offset = $stream->readULong();
     $this->length = $stream->readULong();
     $size = $stream->getSize();
     if ($this->offset < 0 || $this->offset > $size) {
         throw new \Exception('Table offset (' . $this->offset . ') not within expected range');
     }
     if ($this->length < 0 || $this->offset + $this->length > $size) {
         throw new \Exception('Table length (' . $this->length . ') not within expected range');
     }
 }