Java FileWriter Write saveStringInFile(String filePath, String data)

Here you can find the source of saveStringInFile(String filePath, String data)

Description

save String In File

License

Open Source License

Declaration

public static void saveStringInFile(String filePath, String data) throws IOException 

Method Source Code

//package com.java2s;
/*//from   w ww .  j  a v  a 2  s .  com
 * Copyright 2010
 * IBB-CEB - Institute for Biotechnology and Bioengineering - Centre of Biological Engineering
 * CCTC - Computer Science and Technology Center
 *
 * University of Minho 
 * 
 * This is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU Public License as published by 
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version. 
 * 
 * This code 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 Public License for more details. 
 * 
 * You should have received a copy of the GNU Public License 
 * along with this code. If not, see http://www.gnu.org/licenses/ 
 * 
 * Created inside the SysBioPseg Research Group (http://sysbio.di.uminho.pt)
 */

import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void saveStringInFile(String filePath, String data) throws IOException {

        FileWriter file = new FileWriter(filePath);
        try {
            file.write(data);
        } finally {
            file.close();
        }
    }
}

Related

  1. saveStats(String filename, String log)
  2. saveString(File filename, String content)
  3. saveString(String filePath, String content)
  4. saveString(String location, String content)
  5. saveStringFile(String fileName, String str)
  6. saveStringToDisc(final String params, final String filePath)
  7. saveStringToFile(String content, File destFile)
  8. saveStringToFile(String filePath, String content, boolean isOverwrite)
  9. saveStringToFile(String fileToSave, String data)