Ejemplo n.º 1
0
 /**
  * Class constructor
  * 
  * @param   string  The binary data for which to create a stream
  * @return  void
  * @see     Woops_Binary_Stream::__construct
  */
 public function __construct($data = '')
 {
     // Calls the parent constructor
     parent::__construct($data);
     // Checks if we have compressed data
     if ($data && substr($this->_data, 0, 3) === 'CWS') {
         // Sets the compressed flag
         $this->_isCompressed = true;
     }
 }
Ejemplo n.º 2
0
 /**
  * Class constructor
  * 
  * @param   resource    The file handle for which to create a binary stream
  * @param   boolean     Whether to close the file handle or not
  * @return  void
  * @see     Woops_Binary_Stream::__construct
  */
 public function __construct($handle, $closeHandle = true)
 {
     // Checks if the file exists
     if (!is_resource($handle)) {
         // Error - The file does not exist
         throw new Woops_Binary_File_Resource_Stream_Exception('Passed argument must be a valid file handle', Woops_Binary_File_Resource_Stream_Exception::EXCEPTION_NO_RESOURCE);
     }
     // Storage
     $data = '';
     // Reads until the end of the file handle
     while (!feof($handle)) {
         // Reads from the file handle
         $data .= fread($handle, 8192);
     }
     // Checks if we must close the file handle
     if ($closeHandle) {
         // Closes the file handle
         fclose($handle);
     }
     // Calls the parent constructor
     parent::__construct($data);
 }
Ejemplo n.º 3
0
 /**
  * Sets the needed static variables
  * 
  * @return  void
  */
 private static function _setStaticVars()
 {
     // Gets the instance of the string utilities
     self::$_str = Woops_String_Utils::getInstance();
     // Static variables are set
     self::$_hasStatic = true;
 }