Here you can find the source of writeFile(final String outputDir, final String response, final String fileName)
public static void writeFile(final String outputDir, final String response, final String fileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeFile(final String outputDir, final String response, final String fileName) throws IOException { File dir = new File(outputDir); dir.mkdirs();//from ww w .j a va2 s .c o m File file = new File(dir, fileName); final FileWriter writer = new FileWriter(file); try { writer.write(response); } finally { writer.close(); } writer.close(); } public static void writeFile(final File file, final String response) throws IOException { final FileWriter writer = new FileWriter(file); try { writer.write(response); } finally { writer.close(); } writer.close(); } }