Java Write String to File writeFile(String fileName, String contents)

Here you can find the source of writeFile(String fileName, String contents)

Description

write File

License

Open Source License

Declaration

public static void writeFile(String fileName, String contents)
            throws FileNotFoundException, UnsupportedEncodingException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileNotFoundException;

import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class Main {
    public static void writeFile(String fileName, String contents)
            throws FileNotFoundException, UnsupportedEncodingException {
        PrintWriter out = new PrintWriter(fileName, "UTF-8");
        out.write(contents);/* w  w  w  . j  a  va2s  .  c o m*/
        out.close();
    }
}

Related

  1. writeFile(String fileName, String content)
  2. writeFile(String filename, String content)
  3. writeFile(String filename, String content)
  4. writeFile(String fileName, String content, String encoding)
  5. writeFile(String filename, String contents)
  6. writeFile(String fileName, String contents)
  7. writeFile(String fileName, String contentStr, String charset)
  8. writeFile(String filename, String data)
  9. writeFile(String fileName, String data)