class_GzipCompressor.php
Go to the documentation of this file.00001 <?php
00024 class GzipCompressor extends BaseFrameworkSystem implements Compressor {
00030 protected function __construct () {
00031
00032 parent::__construct(__CLASS__);
00033 }
00034
00040 public final static function createGzipCompressor () {
00041
00042 if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) {
00043
00044 $cInstance = new GzipCompressor();
00045 } else {
00046
00047 $cInstance = null;
00048 }
00049
00050
00051 return $cInstance;
00052 }
00053
00061 public function compressStream ($streamData) {
00062 if (is_object($streamData)) {
00063
00064 throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
00065 }
00066
00067
00068 return gzcompress($streamData, 1);
00069 }
00070
00078 public function decompressStream ($streamData) {
00079 if (is_object($streamData)) {
00080
00081 throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
00082 }
00083
00084
00085 return gzuncompress($streamData);
00086 }
00087
00093 public final function getCompressorExtension () {
00094 return "gz";
00095 }
00096 }
00097
00098
00099 ?>