Here you can find the source of writeFile(String aContent, String aFileName)
Parameter | Description |
---|---|
aContent | a parameter |
aFileName | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void writeFile(String aContent, String aFileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { /**/*from www . java2 s.c o m*/ * This function takes a String with some content and a String which is the * filename, writes the content to the file using UTF-8 encoding and finally * closes the file. * * @param aContent * @param aFileName * @throws IOException */ public static void writeFile(String aContent, String aFileName) throws IOException { BufferedWriter fr = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(aFileName), "UTF8")); fr.write(aContent); fr.close(); } }