Home arrow static arrow Java Programming [Archive] - Empty a file.
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Empty a file.
This topic has 2 replies on 1 page.

Posts:12
Registered: 9/25/03
Empty a file.  
Jun 30, 2004 11:36 AM



 
hi, all

I am looking for a way of making a file empty through java API. How to empty an existing file without creating a new one and without lauching operating system's script from java? "empty" means to remove all content inside.

thx for your help
Tim
 

Posts:10,972
Registered: 10/23/03
Re: Empty a file.  
Jun 30, 2004 11:40 AM (reply 1 of 2)



 
[url=http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html#setLength(long)]raf.setLength(0)[/url]
 

Posts:12
Registered: 9/25/03
Re: Empty a file.  
Jun 30, 2004 11:55 AM (reply 2 of 2)



 
cool, thx
 
This topic has 2 replies on 1 page.