My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.lineadecodigo.java.file;

import java.io.File;
import java.io.IOException;

/**
* @file VaciarContenidoFichero2.java
* @version 1.0
* @author Linea de Codigo (http://lineadecodigo.com)
* @date 31-julio-2010
* @url http://lineadecodigo.com/java/vaciar-el-contenido-de-un-fichero-mediante-borrado-y-creacion/
* @description Vaciar el contenido de un fichero borrandolo y volviéndolo a crear.
*/

public class VaciarContenidoFichero2 {

public static void main(String[] args) {

String sFichero = "fichero1.txt";
File f = new File(sFichero);

// Borramos el fichero
f.delete();
try {
f.createNewFile();
} catch (IOException ioe) {
ioe.printStackTrace();
}

}


}

Change log

r265 by vcuervo on Jul 31, 2010   Diff
Vaciar el contenido de un fichero mediante
borrado y creación
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 748 bytes, 33 lines
Powered by Google Project Hosting