• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we flush the contents of a file

 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I want to remove all contents of my file at one go
Is there any API or command that will help me
I want to make my file as a blank file as my application requires it
I found out a method in RandomAccessFile API
setlength(int n)
Will it help me in flushing the contents of the file
or is there any other better alternative?
 
Matt Siegel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using File.createNewFile() will probably do the trick.
Matt
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!