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

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

Description

write String To File

License

Open Source License

Declaration

public static void writeStringToFile(String content, String fileName) 

Method Source Code


//package com.java2s;

import java.io.BufferedWriter;

import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void writeStringToFile(String content, String fileName) {
        try {// w  ww.j av a2s.  c om
            BufferedWriter writer = new BufferedWriter(new FileWriter(fileName));
            writer.write(content);
            writer.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

Related

  1. writeStringToFile(String content, File outputfile)
  2. writeStringToFile(String content, File targetFile)
  3. writeStringToFile(String content, String encoding, String fileName)
  4. writeStringToFile(String content, String filename)
  5. writeStringToFile(String content, String filename)
  6. writeStringToFile(String content, String filename)
  7. writeStringToFile(String content, String fileName, boolean append)
  8. writeStringToFile(String content, String filePath)
  9. writeStringToFile(String content, String path)