Here you can find the source of writeFile(String path, String data)
public static void writeFile(String path, String data) throws IOException
//package com.java2s; //License from project: LGPL import java.io.*; public class Main { public static void writeFile(String path, String data) throws IOException { File file = new File(path.substring(0, path.lastIndexOf("/"))); file.mkdirs();/*from w w w.jav a 2s. co m*/ FileWriter fileWriter = new FileWriter(path); BufferedWriter out_j = new BufferedWriter(fileWriter); out_j.write(data); out_j.close(); } }