本文整理汇总了PHP中lzf_decompress函数的典型用法代码示例。如果您正苦于以下问题:PHP lzf_decompress函数的具体用法?PHP lzf_decompress怎么用?PHP lzf_decompress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lzf_decompress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decompress
/**
* Decompress the given value with the specific compression
*
* @param String $sValue
*
* @return String
*
* @throws Exception
*/
public function decompress($sValue)
{
if (!is_string($sValue)) {
throw new Exception('Invalid first argument, must be a string');
}
return lzf_decompress($sValue);
}
示例2: uncompress
public function uncompress($data = '', $small = 0)
{
if (!isValue($data)) {
return Error::set(lang('Error', 'valueParameter', '1.(data)'));
}
return lzf_decompress($data);
}
示例3: decompress
/**
* Decompresses the given content
*
* @param string $content
* @return string
*/
public function decompress($content)
{
$compressed = lzf_decompress($content);
if (!$compressed) {
throw new Zend_Filter_Exception('Error during compression');
}
return $compressed;
}
示例4: decompress
/**
* Decompresses the given content
*
* @param string $content
* @return string
* @throws Exception\RuntimeException if error occurs during decompression
*/
public function decompress($content)
{
$compressed = lzf_decompress($content);
if (!$compressed) {
throw new Exception\RuntimeException('Error during decompression');
}
return $compressed;
}
示例5: decompress
/**
* Decompresses the given content
*
* @param string $content
* @return string
*/
public function decompress($content)
{
$compressed = lzf_decompress($content);
if (!$compressed) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('Error during compression');
}
return $compressed;
}
示例6: decompress
/**
* Decompresses the given content
*
* @param string $content
* @return string
*/
public function decompress($content)
{
$compressed = lzf_decompress($content);
if (!$compressed) {
require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Filter/Exception.php';
throw new IfwPsn_Vendor_Zend_Filter_Exception('Error during compression');
}
return $compressed;
}
示例7: _decodeData
public function _decodeData($data)
{
switch (substr($data, 0, 4)) {
// asking the data which library it uses allows for transparent changes of libraries
case ':sn:':
return snappy_uncompress(substr($data, 4));
case ':lz:':
return lzf_decompress(substr($data, 4));
case ':gz:':
return gzuncompress(substr($data, 4));
}
return $data;
}
示例8: read_sub
/**
* バックアップファイルの内容を圧縮形式に応じて取得する
* TODO:gzとbz2解凍がスレッドセーフでない
* @access private
*
* @return Array ファイルの内容
*/
private function read_sub($ext, $join)
{
// ファイルを取得
$data = '';
switch ($ext) {
case '.txt':
$data = parent::get();
break;
case '.lzf':
$data = lzf_decompress(parent::get());
break;
case '.gz':
$handle = gzopen($this->filename, 'r');
while (!gzeof($handle)) {
$data .= gzread($handle, 1024);
}
gzclose($handle);
break;
case '.bz2':
$handle = bzopen($this->filename, 'r');
while (!feof($handle)) {
$data .= bzread($handle, 1024);
}
bzclose($handle);
break;
}
// 取得した内容を改行ごとに配列として返す
return $join ? $data : explode("\n", $data);
}
示例9: decompress
/**
* Decompress data
*
* @param string $data
* @return string
* @throws Exception
*/
protected function decompress($data)
{
switch ($this->compression) {
case self::COMPRESSION_LZ4:
$decompressedData = @lz4_uncompress($data);
if (false === $decompressedData) {
throw new Exception('Error decompressing with lz4_uncompress.');
}
break;
case self::COMPRESSION_SNAPPY:
$decompressedData = @snappy_uncompress($data);
if (false === $decompressedData) {
throw new Exception('Error decompressing with snappy_uncompress.');
}
break;
case self::COMPRESSION_LZF:
$decompressedData = @lzf_decompress($data);
if (false === $decompressedData) {
throw new Exception('Error decompressing with lzf_decompress.');
}
break;
case self::COMPRESSION_GZ:
$decompressedData = @gzuncompress($data);
if (false === $decompressedData) {
throw new Exception('Error decompressing with gzuncompress.');
}
break;
case self::COMPRESSION_NONE:
default:
$decompressedData = $data;
}
return $decompressedData;
}
示例10: decompress
/**
*/
public function decompress($text)
{
return strlen($text) ? @lzf_decompress($text) : '';
}
示例11: get
/**
* Return cached data.
*
* @param string $key Cache key.
*
* @return mixed Cache data, or false if not found.
*/
public function get($key)
{
if ($this->_mask & self::APC) {
$data = apc_fetch($key);
} elseif ($this->_mask & self::XCACHE) {
$data = xcache_get($key);
} elseif ($this->_mask & self::EACCELERATOR) {
$data = eaccelerator_get($key);
} elseif ($this->_mask & self::TEMPFILE) {
$data = @file_get_contents($this->_tempdir . '/' . $key);
if ($data === false) {
unlink($this->_tempdir . '/' . $key);
}
} else {
return false;
}
if ($data) {
if ($this->_mask & self::LZ4) {
$data = @horde_lz4_uncompress($data);
} elseif ($this->_mask & self::LZF) {
$data = @lzf_decompress($data);
}
}
return $data === false ? false : $this->_mask & self::MSGPACK ? msgpack_unpack($data) : @json_decode($data, true);
}
示例12: _decodeData
/**
* @param bool|string $data
* @return string
*/
protected function _decodeData($data)
{
if (substr($data, 2, 3) == self::COMPRESS_PREFIX) {
switch (substr($data, 0, 2)) {
case 'sn':
return snappy_uncompress(substr($data, 5));
case 'lz':
return lzf_decompress(substr($data, 5));
case 'gz':
case 'zc':
return gzuncompress(substr($data, 5));
}
}
return $data;
}
示例13: _unserialize
/**
* Unserialize data.
*
* @param mixed $data The data to be unserialized.
* @param mixed $mode The mode of unserialization. Can be either a
* single mode or array of modes. If array, will be
* unserialized in the order provided.
* @param mixed $params Any additional parameters the unserialization
* method requires.
*
* @return mixed Unserialized data.
* @throws Horde_Serialize_Exception
*/
protected static function _unserialize(&$data, $mode, $params = null)
{
switch ($mode) {
case self::NONE:
break;
case self::RAW:
$data = rawurldecode($data);
break;
case self::URL:
$data = urldecode($data);
break;
case self::WDDX:
$data = wddx_deserialize($data);
break;
case self::BZIP:
// $params['small'] = Use bzip2 'small memory' mode?
$data = bzdecompress($data, isset($params['small']) ? $params['small'] : false);
break;
case self::IMAP8:
$data = quoted_printable_decode($data);
break;
case self::IMAPUTF7:
$data = Horde_String::convertCharset(Horde_Imap_Client_Utf7imap::Utf7ImapToUtf8($data), 'UTF-8', 'ISO-8859-1');
break;
case self::IMAPUTF8:
$data = Horde_Mime::encode($data);
break;
case self::BASIC:
$data2 = @unserialize($data);
// Unserialize can return false both on error and if $data is the
// false value.
if ($data2 === false && $data == serialize(false)) {
return $data2;
}
$data = $data2;
break;
case self::GZ_DEFLATE:
$data = gzinflate($data);
break;
case self::BASE64:
$data = base64_decode($data);
break;
case self::GZ_COMPRESS:
$data = gzuncompress($data);
break;
// $params = Output character set
// $params = Output character set
case self::UTF7:
$data = Horde_String::convertCharset($data, 'utf-7', $params);
break;
// $params = Output character set
// $params = Output character set
case self::UTF7_BASIC:
$data = self::unserialize($data, array(self::BASIC, self::UTF7), $params);
break;
case self::JSON:
$out = json_decode($data);
if (!is_null($out) || strcasecmp($data, 'null') === 0) {
return $out;
}
break;
case self::LZF:
$data = @lzf_decompress($data);
break;
}
if ($data === false) {
throw new Horde_Serialize_Exception('Unserialization failed.');
}
return $data;
}
示例14: decompress
/**
* Static method to decompress data
*
* @param string $data
* @return mixed
*/
public static function decompress($data)
{
return lzf_decompress($data);
}
示例15: decompress
protected function decompress()
{
switch ($this->compress) {
case self::COMPRESS_GZIP:
$this->payload = gzinflate($this->payload);
break;
case self::COMPRESS_BZIP:
$this->payload = bzdecompress($this->payload);
break;
case self::COMPRESS_LZF:
$this->payload = lzf_decompress($this->payload);
break;
case self::COMPRESS_OFF:
default:
//anything but known values result in OFF
break;
}
return true;
}