Java Text File Save writeFile(final File f, final String content)

Here you can find the source of writeFile(final File f, final String content)

Description

Write the content to the file.

License

Open Source License

Parameter

Parameter Description
f the file.
content the content.

Exception

Parameter Description
IOException if any error occurs.

Declaration

public static void writeFile(final File f, final String content) throws IOException 

Method Source Code


//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();
    }
}

Related

  1. writeFile(File path, File file, String content)
  2. writeFile(File path, String fileName, String fileContent)
  3. writeFile(File target, String content)
  4. writeFile(final byte[] content, final String path)
  5. writeFile(final File destination, final List contents)
  6. writeFile(final File outputFile, final String data, final String encoding)
  7. writeFile(final String aText, final File aFile, final String aEncoding)
  8. writeFile(final String file, final String text)
  9. writeFile(final String name, final String s)