You are here

public function PHPExcel_Shared_OLERead::getStream in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLERead.php \PHPExcel_Shared_OLERead::getStream()

* Extract binary stream data * *

Return value

string

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLERead.php, line 173

Class

PHPExcel_Shared_OLERead

Code

public function getStream($stream) {
  if ($stream === NULL) {
    return null;
  }
  $streamData = '';
  if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
    $rootdata = $this
      ->_readData($this->props[$this->rootentry]['startBlock']);
    $block = $this->props[$stream]['startBlock'];
    while ($block != -2) {
      $pos = $block * self::SMALL_BLOCK_SIZE;
      $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
      $block = self::_GetInt4d($this->smallBlockChain, $block * 4);
    }
    return $streamData;
  }
  else {
    $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
    if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
      ++$numBlocks;
    }
    if ($numBlocks == 0) {
      return '';
    }
    $block = $this->props[$stream]['startBlock'];
    while ($block != -2) {
      $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
      $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
      $block = self::_GetInt4d($this->bigBlockChain, $block * 4);
    }
    return $streamData;
  }
}