make File Empty - Java java.io

Java examples for java.io:File Size

Description

make File Empty

Demo Code


//package com.java2s;

import java.io.BufferedWriter;

import java.io.FileWriter;

public class Main {
    public static void makeFileEmpty(String f) throws Exception {
        BufferedWriter bW = new BufferedWriter(new FileWriter(f, false));
        bW.write("");
        bW.close();//from   w  ww.j a  va  2s .c o  m
    }
}

Related Tutorials