_fileHandler = gzopen($this->_filePath, $mode); if (false === $this->_fileHandler) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase('The "%1" file failed to open.', [$this->_filePath]) ); } } /** * {@inheritdoc} */ protected function _write($data) { $result = gzwrite($this->_fileHandler, $data); if (empty($result) && !empty($data)) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath]) ); } } /** * {@inheritdoc} */ protected function _read($length) { return gzread($this->_fileHandler, $length); } /** * {@inheritdoc} */ protected function _eof() { return gzeof($this->_fileHandler); } /** * {@inheritdoc} */ protected function _close() { gzclose($this->_fileHandler); } }