Here you can find the source of writefile(String path, String content)
static public void writefile(String path, String content) throws IOException
//package com.java2s; /* Copyright 2012, UCAR/Unidata. See the LICENSE file for more information. *//*w w w. j av a 2 s.c o m*/ import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; public class Main { static public void writefile(String path, String content) throws IOException { File f = new File(path); if (f.exists()) f.delete(); FileWriter out = new FileWriter(f); out.write(content); out.close(); } static public void writefile(String path, byte[] content) throws IOException { File f = new File(path); if (f.exists()) f.delete(); FileOutputStream out = new FileOutputStream(f); out.write(content); out.close(); } }