Here you can find the source of saveStringIntoFile(String filePath, String contents)
public static boolean saveStringIntoFile(String filePath, String contents)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static boolean saveStringIntoFile(String filePath, String contents) { File file = new File(filePath); try {/*from w w w . j a v a 2 s. co m*/ new FileOutputStream(file).write(contents.getBytes()); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } return true; } }