/** * {@inheritdoc} */ public function readBytes($bytes) { $data = ''; $remaining = $bytes; for ($block = 0; $block < ceil($bytes / $this->encryption->getBlockSize()); $block++) { if ($this->bufferPointer >= $this->encryption->getBlockSize()) { $this->bufferPointer = 0; $buffer = $this->stream->readBytes($this->encryption->getBlockSize()); $this->buffer = $this->encryption->decrypt($buffer, $this->encryption->getBlockSize()); } $data .= substr($this->buffer, $this->bufferPointer, $remaining); $this->bufferPointer += $remaining > $this->encryption->getBlockSize() ? $this->encryption->getBlockSize() : $remaining; $remaining -= $this->encryption->getBlockSize(); } return $data; }
public function __construct(Stream $stream) { $buffer = ''; while ($read = $stream->readBytes(10240)) { $buffer .= $read; } $this->resource = self::createImageResourceFromTGA($buffer); $buffer = NULL; }
/** * {@inheritdoc} */ public function readBytes($bytes) { return $this->compression->decompress($this->stream->readBytes($bytes), $bytes); }
/** * @inheritDoc */ public function readBytes($bytes) { $this->align(); return $this->stream->readBytes($bytes); }