File changes are made in memory only, until this methods actually applies
them on the filesystem.

@param File $file

@throws \Symfony\Component\Filesystem\Exception\IOException If the file cannot be written to.

@api
962587
public function save(File $file, $filename = null)
    {
        if ($filename !== null) {
            $file->setFilename($filename);
        }

        $this->filesystem->write($file);
    }
999880
public function storeFile($file)
    {
        $filename = md5($this->id);
        $data = file_get_contents($file->tmp_name);

        if ($this->getFileName() == $this->name) {
            $this->name = $file->name;
        }

        $file->append(array(
            'type' => mime_content_type($file->name),
        ));

        $this->mimeType = $file->type;
        $this->setValue('file_name', $file->name);
        $this->fileSize = strlen($data);
        $this->writeData($filename, $data, false);
    }
1106004
public function delete( $file ) {
		$key = array_search( $file, $this->assets[ $this->type ] );
		unset( $this->assets[ $this->type ][ $key ] );
		unset( $this->attr[ $this->type ][ $key ] );
	}
284570
public void saveAs(final File file) throws IOException {
        try {
            final FileOutputStream out = new FileOutputStream(file);
            try {
                this.save(out);
            } finally {
                out.flush();
                out.close();
            }
        } catch (final FileNotFoundException e) {
            this.logger.log(Level.SEVERE, "Can't open " + file, e);
            throw new IOException(e);
        } catch (final NullPointerException e) {
            this.logger.log(Level.SEVERE, "No file", e);
            throw new IOException(e);
        }
    }
191311
public void storeLocal(final File file) throws IOException {
    final BufferedOutputStream out =
        new BufferedOutputStream(new FileOutputStream(file));
    try {
      storeLocal(out);
    } finally {
      out.close();
    }
  }
1089510
public static function setFile($file)
    {
        if (is_file($file)) {
            $options = Yaml::parse(file_get_contents($file));
            self::$instance = new self($options);
            self::$instance->validateOptions();
        } else {
            throw new Exception("Can't find config file at ".$file);
        }
    }
1000445
public function writePoFile(string $file): void
    {
        $source = $this->dumpString();
        $testName = file_exists($file) ? $file : dirname($file);
        $status = is_writable($testName);
        if ($status === true) {
            $status = file_put_contents($file, $source);
        }
        if (false === $status) {
            throw new FileNotWritableException($file);
        }
    }
276777
public function setFile(File $file)
    {
        $this->file = $file;

        if ($this->file) {
            $this->updatedAt = new \DateTime('now');
        }

        return $this;
    }
675089
public static void delete(final @NonNull File file) throws IOException
	{
		if (file.isDirectory())
		{
			DeleteFileExtensions.deleteAllFiles(file);
		}
		else
		{
			String error = null;
			// If the file is not deleted
			if (!file.delete())
			{
				error = "Cannot delete the File " + file.getAbsolutePath() + ".";

				throw new IOException(error);

			}
		}
	}
818366
private static function saveFile($file, $json)
    {
        if (@file_put_contents($file, $json) === false) {
            $message = 'Could not create file in';
            throw new JsonException($message . ' ' . $file);
        }
    }
299270
public function create($file = '')
    {
        $this->file   = $file;
        $this->memory = '';
        $this->fh     = 0;

        if ($this->file) {
            $this->fh = @fopen($this->file, 'wb');

            if (!$this->fh) {
                throw new ArchiveIOException('Could not open file for writing: '.$this->file);
            }
        }
        $this->writeaccess = true;
        $this->closed      = false;
        $this->ctrl_dir    = array();
    }
895626
public function set_file($file) {
        if (!file_exists($file) || (!is_readable($file))) {
            throw new progressive_parser_exception('invalid_file_to_parse');
        }
        $this->file = $file;
        $this->contents = null;
    }
843180
private function isFile($file)
	{
		if(!!file_exists($file))
		{
			if(!!is_writable($file))
			{
				return TRUE;
			}
			else
			{
				$this->fileNotWritable($file);
			}
		}
		return FALSE;
	}
869681
public function fileAppend($file, $data)
    {
        $file = $this->alias->resolve($file);
        $this->_dirCreate(dirname($file));

        if (file_put_contents($file, $data, LOCK_EX | FILE_APPEND) === false) {
            throw new RuntimeException(['write `:file` file failed: :last_error_message', 'file' => $file]);
        }
    }
519496
public static function chmod($file, $mode)
    {
        if (!@chmod($file, $mode)) {
            throw new IOException(sprintf("Cannot chmod %s to %s", $file, $mode));
        }
    }
1123467
public void save(File file) throws IOException {
        try (FileOutputStream fout = new FileOutputStream(file)) {
            save(fout);
        }
    }
1097688
public function setLocation(string $file, int $line)
    {
        $this->file = $file;
        $this->line = $line;
    }