Java Write String to File WriteFile(String filename, String content)

Here you can find the source of WriteFile(String filename, String content)

Description

Write File

License

Open Source License

Declaration

public static void WriteFile(String filename, String content) throws IOException 

Method Source Code


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

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class Main {
    private static int createdFiles = 1;

    public static void WriteFile(String filename, String content) throws IOException {
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename)));
        writer.write(content);/*from  ww w . j a v a  2s  .c  o  m*/
        writer.close();
        System.out.println("[" + createdFiles + "] Created: " + filename);
        createdFiles++;
    }
}

Related

  1. writeFile(String datafile, String filePath)
  2. writeFile(String destination, byte[] data, boolean append)
  3. writeFile(String filename, Object object)
  4. writeFile(String filename, String content)
  5. writeFile(String fileName, String content)
  6. writeFile(String filename, String content)
  7. writeFile(String filename, String content)
  8. writeFile(String filename, String content)
  9. writeFile(String fileName, String content)