Save a string to a file.

@param content the string to be written to file
@param file    fhe file object
961633
public void stringToFile(String content, File file) throws IOException {
        stringToOutputStream(content, new FileOutputStream(file));
    }
116586
protected void saveFile(SebEvent event, String content, String name, String extension) {
		event.saveFile(content, getListenerFileName(name), extension);
	}
658264
function (content) {
      var fileContent = self._readFileSync();

      fileContent.instances = fileContent.instances || {};
      fileContent.instances[this._id] = _.assign(fileContent.instances[this._id] || {}, content);
      self._writeFileSync(fileContent);
    }
92094
public void save(File file) throws IOException {

        Writer writer = null;

        try {
            writer = new Writer(file);
            writer.println(toPrettyString());
        } finally {
            if (writer != null) writer.close();
        }
    }
1296652
public static void saveFile(final File file, byte[] fileContents) throws IOException {
        if (file.isDirectory()) {
            throw new IOException("Unable to save file contents as a directory.");
        }

        final FileOutputStream fos = new FileOutputStream(file);
        fos.write(fileContents);
        fos.flush();
        fos.close();
    }
18450
@JsonIgnore
    public void encodeAndSetContent(String content) {
        encodeAndSetContent(content != null ? content.getBytes() : null);
    }
621135
@Deprecated
    public static void writeContent(CharSequence content, File file, String encoding) {
        write(content, file, encoding);
    }
1158146
public void save(String file) throws IOException,FileNotFoundException
	{
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
		oos.writeObject(blockerNames);
		oos.writeObject(datasetNames);
		oos.writeObject(learnerNames);
		oos.writeObject(expt);
		oos.close();
	}
250441
protected function write($content, $file)
    {
        if (file_exists($file)) { // Do not create a new file
            return file_put_contents($file, $content) !== false;
        }

        return false;
    }
1212640
public static void writeToFile(File file, String content, Charset charset) throws IOException {
        FileOutputStream fos = null;
        OutputStreamWriter writer = null;
        try {
            if (file == null) {
                throw new FileNotFoundException("No file specified.");
            } else if (!file.exists() && !file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
                throw new FileNotFoundException("Could not find or create file:" + file.getName());
            }
            fos = new FileOutputStream(file);
            writer = new OutputStreamWriter(fos, charset);
            writer.write(content, 0, content.length());
            writer.flush();
        } finally {
            Closeables.closeQuitely(fos);
            Closeables.closeQuitely(writer);
        }
    }
1096793
protected function saveMap($file, $content){
		$dir = dirname($file);
		// directory does not exist
		if( !is_dir($dir) ){
			// FIXME: create the dir automatically?
			throw new Exception(sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir));
		}
		// FIXME: proper saving, with dir write check!
		if(file_put_contents($file, $content) === false){
			throw new Exception(sprintf('Cannot save the source map to "%s"', $file));
		}
		return true;
	}
98772
public void add(String file, String contents) throws IOException {
		FileUtils.writeStringToFile(tempDir.resolve(file).toFile(), contents);
	}
106359
public void stringToFile(String content, String filename) throws IOException {
        stringToOutputStream(content, new FileOutputStream(filename));
    }
83507
public static void write(File file, String text) throws IOException {
        Writer writer = null;
        try {
            writer = new FileWriter(file);
            writer.write(text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }
644291
public static void writeTXT(String string, File file) throws IOException {
		BufferedWriter out = new BufferedWriter(new FileWriter(file));
		out.write(string);
		out.close();
	}
488425
public static boolean writeString(String filePath, String content, boolean append) throws IOException {
        return writeString(filePath != null ? new File(filePath) : null, content, append);
    }
1130038
public static function write(string $file, $content, int $mode = 0666): void
	{
		NetteFileSystem::write($file, $content, $mode);
	}