Java Write String to File writeFile(File file, String content)

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

Description

write File

License

Open Source License

Declaration

public static void writeFile(File file, String content) 

Method Source Code


//package com.java2s;
/*/*from   w ww .j  a  v  a 2s . c  om*/
 * Copyright (c) 2013, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */

import java.io.*;

public class Main {

    public static void writeFile(File file, String content) {
        FileWriter fw = null;
        try {
            fw = new FileWriter(file);
            fw.write(content);
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fw != null) {
                    fw.close();
                }
            } catch (IOException e) {

            }
        }
    }
}

Related

  1. writeFile(File f, String str)
  2. writeFile(File f, String str)
  3. writeFile(File f, String text)
  4. writeFile(File file, Iterable lines)
  5. writeFile(File file, String content)
  6. writeFile(File file, String content)
  7. writeFile(File file, String content)
  8. writeFile(File file, String content)
  9. writeFile(File file, String content)