Here you can find the source of writeFile(String filename, String content)
Parameter | Description |
---|---|
filename | the path of the file |
content | the content of the file |
public static void writeFile(String filename, String content)
//package com.java2s; import java.io.FileOutputStream; public class Main { /**/*from ww w. ja va2 s . c om*/ * Writes a files with a certain path with content. * * @param filename the path of the file * @param content the content of the file */ public static void writeFile(String filename, String content) { try { FileOutputStream fos = new FileOutputStream(filename); fos.write(content.getBytes()); fos.close(); } catch (Exception e) { System.err.println(e); e.printStackTrace(); } } }