public function __construct(Stream $stream) { $buffer = ''; while ($read = $stream->readBytes(10240)) { $buffer .= $read; } $this->resource = self::createImageResourceFromTGA($buffer); $buffer = NULL; }
public function parse() { if ($this->isParsed()) { return; } $parser = new BinaryStreamParser($this->stream); $signature = $this->parseSignature($parser); if ($signature == "MPQ27") { $this->userData = UserData::parse($parser); $this->stream->seek($this->getUserDataOffset()); $signature = $this->parseSignature($parser); } if ($signature == "MPQ26") { $this->header = Header::parse($parser); } $this->hashTable = $this->parseHashTable(); $this->blockTable = $this->parseBlockTable(); $this->parsed = true; }
/** * {@inheritdoc} */ public function eof() { return $this->stream->eof(); }
private function readSector(Sector $sector) { $this->stream->seek($this->file->getUserDataOffset() + $this->block->getFilePos() + $sector->getStart()); $compressedStream = $this->createCompressedStream($sector); return $compressedStream->readBytes($this->block->getSize()); }