public function writeBinary($file, $data, $create = true, $append = false, $modeBoolean = true)
    {
        // Preprocessing
        $file = $this->_preProcess($file);

        // exception for the case that the file|folder isn't writable
        if (!$this->_is_writable($file)) {
            throw new Doozr_Exception(
                'Could not write binary data to file. The file "'.$file.'" could not be written. '.
                'Current operation failed. Check permissions.'
            );
        }

        // append or complete rewrite file?
        if ($append) {
            $result = $this->_append($file, $data, $create, self::FILE_BINARY);
        } else {
            $result = $this->_rewrite($file, $data, $create, self::FILE_BINARY);
        }

        // transform result?
        if ($modeBoolean) {
            $result = ($result !== false) ? true : false;
        }

        // return the result of operation
        return $result;
    }
public function writeBinary($file, $data, $create = true, $append = false, $modeBoolean = true)
    {
        // Preprocessing
        $file = $this->_preProcess($file);

        // exception for the case that the file|folder isn't writable
        if (!$this->_is_writable($file)) {
            throw new Doozr_Exception(
                'Could not write binary data to file. The file "'.$file.'" could not be written. '.
                'Current operation failed. Check permissions.'
            );
        }

        // append or complete rewrite file?
        if ($append) {
            $result = $this->_append($file, $data, $create, self::FILE_BINARY);
        } else {
            $result = $this->_rewrite($file, $data, $create, self::FILE_BINARY);
        }

        // transform result?
        if ($modeBoolean) {
            $result = ($result !== false) ? true : false;
        }

        // return the result of operation
        return $result;
    }
public function writeBinary ( $ file , $ data , $ create = true , $ append = false , $ modeBoolean = true ) { // Preprocessing $ file = $ this -> _preProcess ( $ file ) ; // exception for the case that the file|folder isn't writable if ( ! $ this -> _is_writable ( $ file ) ) { throw new Doozr_Exception ( 'Could not write binary data to file. The file "' . $ file . '" could not be written. ' . 'Current operation failed. Check permissions.' ) ; } // append or complete rewrite file? if ( $ append ) { $ result = $ this -> _append ( $ file , $ data , $ create , self :: FILE_BINARY ) ; } else { $ result = $ this -> _rewrite ( $ file , $ data , $ create , self :: FILE_BINARY ) ; } // transform result? if ( $ modeBoolean ) { $ result = ( $ result !== false ) ? true : false ; } // return the result of operation return $ result ; }
Writes binary-data to a file

This method is intend to write binary-data to a file.

@param string $file        The file to write the content to
@param string $data        The content to write to the file
@param bool   $create      TRUE to create file if it not exist, FALSE to do not
@param bool   $append      Controls if the content should be appended or rewrite the file
@param bool   $modeBoolean TRUE to return result as bool, otherwise FALSE to return number of bytes written

@author Benjamin Carl <opensource@clickalicious.de>
@return mixed Number of bytes written if everything wents fine, otherwise false
@access public
@throws Doozr_Exception
Writes binary - data to a file