Java Text File Save writefile(String path, String content)

Here you can find the source of writefile(String path, String content)

Description

writefile

License

Open Source License

Declaration

static public void writefile(String path, String content)
            throws IOException 

Method Source Code

//package com.java2s;
/* Copyright 2012, UCAR/Unidata.
 See the LICENSE file for more information.
 *//*w w  w.  j av  a  2  s.c  o  m*/

import java.io.File;

import java.io.FileOutputStream;

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

public class Main {
    static public void writefile(String path, String content)
            throws IOException {
        File f = new File(path);
        if (f.exists())
            f.delete();
        FileWriter out = new FileWriter(f);
        out.write(content);
        out.close();
    }

    static public void writefile(String path, byte[] content)
            throws IOException {
        File f = new File(path);
        if (f.exists())
            f.delete();
        FileOutputStream out = new FileOutputStream(f);
        out.write(content);
        out.close();
    }
}

Related

  1. writeFile(List txtList, String MyFilePath)
  2. writeFile(String file, String content)
  3. writeFile(String file, String text)
  4. writeFile(String filePath, List lines)
  5. writeFile(String path, String content)
  6. writeFile(String path, String content)
  7. writefile(String path, String content)
  8. writefile(String path, String content, boolean append)
  9. writeFile(String path, String contents)