Java Text File Write writeStringToFile(String content, File targetFile)

Here you can find the source of writeStringToFile(String content, File targetFile)

Description

write String To File

License

Apache License

Declaration

public static void writeStringToFile(String content, File targetFile) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.FileWriter;

public class Main {
    public static void writeStringToFile(String content, File targetFile) throws Exception {
        FileWriter writer = new FileWriter(targetFile);
        writer.write(content);/*ww w.  j  a  v  a 2 s  .  co  m*/
        writer.flush();
        writer.close();
    }
}

Related

  1. writeStringToFile(final String string, final File file)
  2. writeStringToFile(final String text, final File filePath)
  3. writeStringToFile(String content, File file)
  4. writeStringToFile(String content, File file)
  5. writeStringToFile(String content, File outputfile)
  6. writeStringToFile(String content, String encoding, String fileName)
  7. writeStringToFile(String content, String filename)
  8. writeStringToFile(String content, String filename)
  9. writeStringToFile(String content, String fileName)