Here you can find the source of writeStringToFile(File file, String content)
public static void writeStringToFile(File file, String content) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2015-2016 Obeo, Inria//from w ww. j a v a2s.c o m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * William Piers <william.piers@obeo.fr> * Philippe Merle <philippe.merle@inria.fr> *******************************************************************************/ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeStringToFile(File file, String content) throws IOException { BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); stream.write(content.getBytes()); stream.close(); } }