_fileHandler = bzopen($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 = bzwrite($this->_fileHandler, $data); if (false === $result) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath]) ); } } /** * {@inheritdoc} */ protected function _read($length) { $data = bzread($this->_fileHandler, $length); if (false === $data) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase('Failed to read data from %1', [$this->_filePath]) ); } return $data; } /** * {@inheritdoc} */ protected function _close() { bzclose($this->_fileHandler); } }