{@inheritdoc}

@throws \Symfony\Component\Filesystem\Exception\IOException If the file cannot be written to.
355678
public function createTempFile($prefix, $content)
    {
        $filePath = $this->createTempName($prefix);
        $this->dumpToFile($filePath, $content);

        return $filePath;
    }
1265577
public void write(File file) throws IOException {
        try (InputStream inputStream = getInputStream()) {
            IoUtils.copy(inputStream, file);
        }
    }
1255135
public function transform() {
        $originalFile = $this->getOriginalFile();
        $transformedFiles = array();
        $error = null;

        if (!$originalFile) {
            throw new IoException('No original file detected');
        }

        // Apply transformations to original
        if ($this->_selfTransformers) {
            foreach ($this->_selfTransformers as $transformer) {
                try {
                    $originalFile = $transformer->transform($originalFile, true);

                } catch (Exception $e) {
                    $error = $e->getMessage();
                    break;
                }
            }

            $originalFile->reset();
        }

        // Create transformed files based off original
        if ($this->_transformers && !$error) {
            foreach ($this->_transformers as $transformer) {
                try {
                    $transformedFiles[] = $transformer->transform($originalFile, false);

                } catch (Exception $e) {
                    $error = $e->getMessage();
                    break;
                }
            }
        }

        $this->_file = $originalFile;
        $this->_files = $transformedFiles;

        // Throw error and rollback
        if ($error) {
            $this->rollback();

            throw new TransformationException($error);
        }

        return true;
    }
327339
public function overwrite($file, $content)
    {
        $written = file_put_contents($file, $content);

        // If $content is not empty
        // but nothing was written to $file
        // throw an exception.
        if ($content and ! $written)
        {
            throw new RuntimeException(
                "Unable to write to {$file}."
            );
        }
    }
1107598
static function write($filename, $contents, $overwriteExisting = true) {
        if (file_exists($filename) && self::isWritable($filename)) {
            if ($overwriteExisting) unlink($filename);
        }

        file_put_contents($filename, $contents);
    }
1021796
public function write()
    {
        
        $tf = $this->getTranslationFile();
        $buffer = "<?php\n";
        foreach ($tf->getTranslationUnits() as $tu){
            // Prevent empty messages.
            if ($tu->getSource() != '' && $tu->getTarget() != ''){
                $escapes = array("\\", '$', '"', "\n", "\t", "\v", "\r", "\f");
                $replace = array("\\\\", '\\$', '\\"', "\\n", "\\t", "\\v", "\\r", "\\f");
                $source = str_replace($escapes, $replace, $tu->getSource());
                $target = str_replace($escapes, $replace, $tu->getTarget());
                $buffer .= '$GLOBALS[\'__l10n\']["' . $source . '"]="' . $target . '";' . "\n";
            }
        }
        $buffer .= "\n?>";
        
        file_put_contents($this->getFilePath(), $buffer);
        
    }
1231378
public function copyTo($file)
    {
        if (null === $this->file) {
            throw LogicException::create(
                'The update file has not been downloaded.'
            );
        }

        $mode = 0755;

        if (file_exists($file)) {
            $mode = fileperms($file) & 511;
        }

        if (false === @copy($this->file, $file)) {
            throw FileException::lastError();
        }

        if (false === @chmod($file, $mode)) {
            throw FileException::lastError();
        }

        $key = $file . '.pubkey';

        if (file_exists($this->file . '.pubkey')) {
            if (false === @copy($this->file . '.pubkey', $key)) {
                throw FileException::lastError();
            }
        } elseif (file_exists($key)) {
            if (false === @unlink($key)) {
                throw FileException::lastError();
            }
        }
    }
453516
def write_file(self, name, path=None):
        """"""

        if path is None:
            path = name

        self.zf.write(path, name)
53203
protected function save()
    {
        if (false === ($result = @file_put_contents($this->getFilename(), $this->token))) {
            throw new \Exception(sprintf('Token could not be saved to "%s"', $this->getFilename()));
        }
    }
1100603
public function persist(): void
    {
        if (!\file_put_contents($this->indexFilepath, \serialize($this->index), LOCK_EX)) {
            throw new IndexException('Unable to persist index to file: '.$this->indexFilepath); // @codeCoverageIgnore
        }
        $this->status = IndexInterface::STATUS_LOADED;
    }
423654
protected function write($messages, $file)
    {
        $f = @fopen($file, 'a');
        if ($f === false)
        {
            throw new \Exception("Logfile $file is not writeable!");
        }

        foreach($messages as $msg)
        {
            fwrite($f, $msg);
        }

        fclose($f);
    }
457850
public function lock()
    {
        if ($this->isRunning())
            return false;

        $pidFile = $this->directory.$this->filename;

        if (!is_writable($this->directory)) {
            throw new \Exception('Can not write to folder: '.$this->directory);
        }

        if (file_exists($pidFile) && !is_writable($pidFile)) {
            throw new \Exception('Can not write to file: '.$pidFile);
        }

        $file = fopen($pidFile, 'w');
        if ($file === false) {
            return false;
        }

        fputs($file, getmypid());
        fclose($file);

        return true;
    }
831458
public function write() {
        $filename = $this->getFileName();
        if(basename($filename) == '.php') {
            throw new CatchableException('Invalid Filename: '.$filename);
        }
        if(!is_dir(dirname($filename))) {
            mkdir(dirname($filename), 0777, true);
        }
        file_put_contents($filename, $this->toString());
    }
102275
private function write()
    {
        if (!$this->file->canWrite()) {
            throw new BuildException(
                "Can't write data store to '" .
                $this->file->getPath() . "'"
            );
        } else {
            $serializedData = serialize($this->data);

            $writer = new FileWriter($this->file);
            $writer->write($serializedData);
            $writer->close();
        }
    }
595354
public static void writeFile(byte[] content,File file) throws IOException
    {
        OutputStream outputStream=null;
        try
        {
            //create output stream to file
            outputStream=new FileOutputStream(file);
            
            //write to file
            outputStream.write(content);
        }
        finally
        {
            //close writer
            IOHelper.closeResource(outputStream);
        }
    }
1358271
@Override
    @FFDCIgnore({ IOException.class })
    public void writeFile(FileChannel fc) throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "writeFile: " + fc);
        }
        if (cannotWriteFC()) {
            // not file channel capable
            convertFile(fc);
            return;
        }
        // make sure the headers are written separately from the file buffer
        flushHeaders();
        WsByteBuffer fb = HttpDispatcher.getBufferManager().allocateFileChannelBuffer(fc);
        try {
            // TODO should adjust write timeout based on file size. Large files
            // can only be written so fast so a 1Gb file should have larger
            // timeout than a 100K file
            this.isc.sendResponseBody(new WsByteBuffer[] { fb });
            this.bytesWritten += fc.size();
        } catch (MessageSentException mse) {
            FFDCFilter.processException(mse, getClass().getName(),
                                        "writeFile", new Object[] { this, this.isc });
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Invalid state, message-sent-exception received; " + this.isc);
            }
            this.error = new IOException("Invalid state");
            throw this.error;
        } catch (IOException ioe) {
            // no FFDC required
            this.error = ioe;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Received exception during write: " + ioe);
            }
            throw ioe;
        } finally {
            fb.release();
        }
    }
939969
public function write($file = '') {
        if ($file == '') {
            $file = $this->outSourceFile;
        }

        file_put_contents($file, $this->generate());
    }