Java File Delete clearFile(String directory)

Here you can find the source of clearFile(String directory)

Description

clear File

License

Open Source License

Declaration

public static void clearFile(String directory) 

Method Source Code

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

import java.io.*;

public class Main {
    public static void clearFile(String directory) {

        try {//  w ww .j av  a 2  s  .co m

            FileWriter outFile = new FileWriter(directory);
            PrintWriter out = new PrintWriter(outFile);

            out.print("");
            out.close();

        } catch (IOException e) {

            e.printStackTrace();
        }
    }
}

Related

  1. clearFile(File file)
  2. clearFile(String pFileName)
  3. clearFileOrDir(File file)
  4. delete(File aFile)
  5. delete(File classDir)