Example #1
0
 /**
  * Adds the given file to the hash pool. The hash will be calculated over the total hash pool.
  * @param \System\IO\File The file to include in the hashing
  */
 public final function addFile(\System\IO\File $file)
 {
     if ($this->hash) {
         if ($file->exists()) {
             hash_update_file($this->hash, $file->getFullPath());
         } else {
             throw new \System\Error\Exception\FileNotFoundException('The given file does not exists: ' . $file->getFilename());
         }
     } else {
         throw new \System\Error\Exception\InvalidMethodException('This method is called after finalizing the hash');
     }
 }
Example #2
0
 /**
  * Transfer the file to its new location by copying it.
  * @param \System\IO\File The sourcefile.
  * @return bool True on success, false otherwise
  */
 public final function transferFile(\System\IO\File $file)
 {
     return $this->putBlocking($file->getFilename(), $file->getFullPath());
 }