Here you can find the source of writeFile(final File f, final String content)
Parameter | Description |
---|---|
f | the file. |
content | the content. |
Parameter | Description |
---|---|
IOException | if any error occurs. |
public static void writeFile(final File f, final String content) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { /**//from w ww . ja va 2 s .co m * Write the content to the file. * * @param f the file. * @param content the content. * @throws IOException if any error occurs. * */ public static void writeFile(final File f, final String content) throws IOException { final FileOutputStream o = new FileOutputStream(f); o.write(content.getBytes()); o.close(); } }