Writes the editor file content into given file.

        :param file: File to write.
        :type file: unicode
        :return: Method success.
        :rtype: bool
166786
def write_file(self, file):
        

        LOGGER.debug("> Writing '{0}' file.".format(file))
        writer = foundations.io.File(file)
        writer.content = [self.toPlainText().toUtf8()]
        if writer.write():
            self.set_file(file)

            self.file_saved.emit()
            return True
608949
public static Writer writer(File file) {
        try {
            return new FileWriter(file);
        } catch (IOException e) {
            throw E.ioException(e);
        }
    }
676853
def get_editor(self, file):
        

        for editor in self.__model.list_editors():
            if editor.file == file:
                return editor
1108589
def write(self, output_file):
        
        for message_level, message_text in self:
            output_file.write('%s=%s\r\n' % (message_level, message_text))
        output_file.write('\r\n')
962796
def write_file(self, path, contents):
		
		path = self._get_dist_path(path)
		if not os.path.isdir(os.path.dirname(path)):
			os.makedirs(os.path.dirname(path))
		if isinstance(contents, bytes):
			mode = 'wb+'
		else:
			mode = 'w'
		with open(path, mode) as file:
			file.write(contents)
746337
def set_current_editor(self, file):
        

        index = self.find_editor_tab(file)
        if index is not None:
            self.Script_Editor_tabWidget.setCurrentIndex(index)
            return True
317861
private void writeFileByte(byte[] content, File file) throws IOException {

        FileOutputStream fOut = null;
        DataOutputStream dOut = null;
        try {
            // write the content to the file in server filesystem
            fOut = new FileOutputStream(file);
            dOut = new DataOutputStream(fOut);
            dOut.write(content);
            dOut.flush();
        } catch (IOException e) {
            throw e;
        } finally {
            try {
                if (fOut != null) {
                    fOut.close();
                }
            } catch (IOException e) {
                // ignore
            }
            try {
                if (dOut != null) {
                    dOut.close();
                }
            } catch (IOException e) {
                // ignore
            }
        }
    }
845734
def write(self, config_file):
        
        if config_file not in self.templates:
            log('Config not registered: %s' % config_file, level=ERROR)
            raise OSConfigException

        _out = self.render(config_file)
        if six.PY3:
            _out = _out.encode('UTF-8')

        with open(config_file, 'wb') as out:
            out.write(_out)

        log('Wrote template %s.' % config_file, level=INFO)
314602
def write_file(file_name, file_contents)
      contents =  file_contents
                  .flatten
                  .select { |line| line }
                  .join("\n")
      File.open(file_name, "w") do |fh|
        fh.write(contents)
        fh.write("\n")
      end
    end
552413
def write_file(self, filename):
        
        with open(filename, "w") as f:
            f.write(self.__str__())
1109769
def revert_file(self, file=None):
        

        editor = file and self.get_editor(file) or self.get_current_editor()
        if not editor:
            return False

        file = editor.file
        LOGGER.info("{0} | Reverting '{1}' file!".format(self.__class__.__name__, file))
        if self.reload_file(file, is_modified=False):
            return True
541576
def write(self, filename, header=None):
        

        origfile = self._filename

        try:
            with open(filename, 'w') as _file:
                self.writestream(_file, header)
                self._filename = filename
            return True

        except IOError:
            self._filename = origfile
            return False
35583
def write_file(self, filename='HEADER'):
        
        with open(filename, "w") as f:
            f.write(str(self) + "\n")
141223
def _safe_write_to_file(self, file, message):
        
        target = file
        lock_name = make_lock_name(target, self.outfolder)
        lock_file = self._make_lock_path(lock_name)

        while True:
            if os.path.isfile(lock_file):
                self._wait_for_lock(lock_file)
            else:
                try:
                    self.locks.append(lock_file)
                    self._create_file_racefree(lock_file)
                except OSError as e:
                    if e.errno == errno.EEXIST:
                        print ("Lock file created after test! Looping again.")
                        continue  # Go back to start

                # Proceed with file writing
                with open(file, "a") as myfile:
                    myfile.write(message + "\n")

                os.remove(lock_file)
                self.locks.remove(lock_file)
                
                # If you make it to the end of the while loop, you're done
                break
67594
public static synchronized void saveFile(File file, String content, boolean append) throws IOException {
        if (Checker.isNotNull(file)) {
            if (!file.exists()) {
                file.createNewFile();
            }
            try (BufferedWriter out = new BufferedWriter(new FileWriter(file, append))) {
                out.write(content);
            }
            logger.info("save file '" + file.getAbsolutePath() + "' success");
        }
    }
783289
def _copy_from_to(from_file, to_file):
    
    with pelican_open(from_file) as text_in:
        encoding = 'utf-8'
        with open(to_file, 'w', encoding=encoding) as text_out:
            text_out.write(text_in)
            logger.info('Writing %s', to_file)
238846
public void writeTo(File file) throws IOException {
        FileChannel channel = new FileOutputStream(file).getChannel();
        try {
            writeTo(channel);
        } finally {
            channel.close();
        }
    }