public function __construct($file) { parent::__construct($file, FileDecoder::DECODER_DIRECT); $this->tResource = fopen($file, "r"); if ($this->tResource === false) { throw new Exception(Log::err("Cannot open file '{$file}' for reading")); } }
public function __construct($file) { parent::__construct($file, FileDecoder::DECODER_AUTO); foreach (self::$sDecoders as $pattern => $decoderClass) { if (fnmatch($pattern, $file)) { $this->tDecoder = new $decoderClass($file); break; } } }
public function __construct($file) { parent::__construct($file, FileDecoder::DECODER_BZIP2); if (!extension_loaded("bz2")) { throw new Exception(Log::err("Missing extension 'bz2' for bzip2 decoding")); } $this->tResource = bzopen($file, "r"); if ($this->tResource === false) { throw new Exception(Log::err("Cannot open file '{$file}' for reading")); } }
private function dataSourceFile($data) { if (isset($data["service"])) { $service = trim($data["service"]); $serviceValid = $this->validateAttributeValue("service", $service); } else { $service = $this->tCurrentSourceService; $serviceValid = true; } if (isset($data["decoder"])) { $decoder = trim($data["decoder"]); $decoderValid = $this->validateAttributeValue("decoder", $decoder, FileDecoder::validDecoders()); } else { $decoder = MonitorSourceFile::DECODER_DEFAULT; $decoderValid = true; } $file = $data["value"]; $fileValid = $this->validateElementValue("file", $file); if ($serviceValid && $decoderValid && $fileValid) { $this->tCurrentSource->addFile($file, $service, $decoder); } }
public function getDecoder($logfile) { return FileDecoder::create($logfile, $this->tDecoder); }