_archive = new $zipClass(); $this->_archive->open($url['host']); $this->_fileNameInArchive = $url['fragment']; $this->_position = 0; $this->_data = $this->_archive->getFromName($this->_fileNameInArchive); return true; } /** * Stat stream */ public function streamStat() { return $this->_archive->statName($this->_fileNameInArchive); } /** * Read stream * * @param int $count */ public function streamRead($count) { $ret = substr($this->_data, $this->_position, $count); $this->_position += strlen($ret); return $ret; } /** * Tell stream */ public function streamTell() { return $this->_position; } /** * EOF stream */ public function streamEof() { return $this->_position >= strlen($this->_data); } /** * Seek stream * * @param int $offset * @param mixed $whence */ public function streamSeek($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; } } }