You are here

public function PHPExcel_Shared_ZipStreamWrapper::stream_seek in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/ZipStreamWrapper.php \PHPExcel_Shared_ZipStreamWrapper::stream_seek()

Seek stream * *

Parameters

int $offset byte offset: * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END * @return bool

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/ZipStreamWrapper.php, line 168

Class

PHPExcel_Shared_ZipStreamWrapper
PHPExcel_Shared_ZipStreamWrapper

Code

public function stream_seek($offset, $whence) {
  switch ($whence) {
    case SEEK_SET:
      if ($offset < strlen($this->_data) && $offset >= 0) {
        $this->_position = $offset;
        return true;
      }
      else {
        return false;
      }
      break;
    case SEEK_CUR:
      if ($offset >= 0) {
        $this->_position += $offset;
        return true;
      }
      else {
        return false;
      }
      break;
    case SEEK_END:
      if (strlen($this->_data) + $offset >= 0) {
        $this->_position = strlen($this->_data) + $offset;
        return true;
      }
      else {
        return false;
      }
      break;
    default:
      return false;
  }
}