示例#1
0
 /**
  * {@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;
 }
示例#2
0
 public function __construct(Stream $stream)
 {
     $buffer = '';
     while ($read = $stream->readBytes(10240)) {
         $buffer .= $read;
     }
     $this->resource = self::createImageResourceFromTGA($buffer);
     $buffer = NULL;
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function readBytes($bytes)
 {
     return $this->compression->decompress($this->stream->readBytes($bytes), $bytes);
 }
示例#4
0
 /**
  * @inheritDoc
  */
 public function readBytes($bytes)
 {
     $this->align();
     return $this->stream->readBytes($bytes);
 }