Java Text File Save writeFile(String path, String data)

Here you can find the source of writeFile(String path, String data)

Description

write File

License

LGPL

Declaration

public static void writeFile(String path, String data) throws IOException 

Method Source Code


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

import java.io.*;

public class Main {
    public static void writeFile(String path, String data) throws IOException {
        File file = new File(path.substring(0, path.lastIndexOf("/")));
        file.mkdirs();/*from  w w  w.jav  a 2s. co  m*/

        FileWriter fileWriter = new FileWriter(path);
        BufferedWriter out_j = new BufferedWriter(fileWriter);
        out_j.write(data);
        out_j.close();

    }
}

Related

  1. writefile(String path, String content)
  2. writeFile(String path, String content)
  3. writeFile(String path, String content)
  4. writefile(String path, String content, boolean append)
  5. writeFile(String path, String contents)
  6. writeFile(String path, String fileName, String content)
  7. writeFile(String path, String fileName, String content, String charset)
  8. writeFile(String path, String fileName, String data)
  9. writeFile(String path, String text)