public function prepend($data) {

		if(false === is_string($data)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
		}

		if(false !== $this -> file -> getExists()) {

			$this -> refresh();

    		if(false === $this -> file -> getWritable()) {
    			trigger_error(sprintf('File "%s" is not writable', $this -> file -> getBasepath()), E_USER_ERROR);
	    	}

    		$handle 	= fopen($this -> file -> getBasepath(), 'r+');
			$len 		= strlen($data);
			$final_len 	= filesize($this -> file -> getBasepath()) + $len;
			$cache_old 	= fread($handle, $len);
			
			rewind($handle);
			
			$i = 1;
			
			while(ftell($handle) < $final_len) {

				fwrite($handle, $data);
				
				$data 		= $cache_old;
				$cache_old 	= fread($handle, $len);

				fseek($handle, $i * $len);
				
				$i++;
			}
		}

		return $this;
	}
public function prepend($data) {

		if(false === is_string($data)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
		}

		if(false !== $this -> file -> getExists()) {

			$this -> refresh();

    		if(false === $this -> file -> getWritable()) {
    			trigger_error(sprintf('File "%s" is not writable', $this -> file -> getBasepath()), E_USER_ERROR);
	    	}

    		$handle 	= fopen($this -> file -> getBasepath(), 'r+');
			$len 		= strlen($data);
			$final_len 	= filesize($this -> file -> getBasepath()) + $len;
			$cache_old 	= fread($handle, $len);
			
			rewind($handle);
			
			$i = 1;
			
			while(ftell($handle) < $final_len) {

				fwrite($handle, $data);
				
				$data 		= $cache_old;
				$cache_old 	= fread($handle, $len);

				fseek($handle, $i * $len);
				
				$i++;
			}
		}

		return $this;
	}
public function prepend ( $ data ) { if ( false === is_string ( $ data ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; if ( false === $ this -> file -> getWritable ( ) ) { trigger_error ( sprintf ( 'File "%s" is not writable' , $ this -> file -> getBasepath ( ) ) , E_USER_ERROR ) ; } $ handle = fopen ( $ this -> file -> getBasepath ( ) , 'r+' ) ; $ len = strlen ( $ data ) ; $ final_len = filesize ( $ this -> file -> getBasepath ( ) ) + $ len ; $ cache_old = fread ( $ handle , $ len ) ; rewind ( $ handle ) ; $ i = 1 ; while ( ftell ( $ handle ) < $ final_len ) { fwrite ( $ handle , $ data ) ; $ data = $ cache_old ; $ cache_old = fread ( $ handle , $ len ) ; fseek ( $ handle , $ i * $ len ) ; $ i ++ ; } } return $ this ; }
Prepends data to current file
@param string $data
@return sFire\System\File
Prepends data to current file