Here you can find the source of saveStringFile(String fileName, String str)
public static boolean saveStringFile(String fileName, String str)
//package com.java2s; /*//from w ww . java 2 s .c om * ArikTools * Copyright (C) Arik Z.Lakritz, Peter Macko, and David K. Wittenberg * * This file is part of ArikTools. * * ArikTools is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ArikTools is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ArikTools. If not, see <http://www.gnu.org/licenses/>. */ import java.io.*; public class Main { /** * Save a file */ public static boolean saveStringFile(String fileName, String str) { File f = new File(fileName); try { PrintWriter w = new PrintWriter(new FileWriter(f)); w.print(str); w.close(); } catch (java.io.IOException e) { System.err.println(e); return false; } return true; } }