• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to delete the content of a file  RSS feed

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respected Sir,
I want to delete the previous contents of a file ...
and start to write new strings to the fiel is there any method to doing this .
kindly suggest me .....


please help me...

Thank you
Pradipta Kumar Rout
 
Ranch Hand
Posts: 118
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check usage of FileOutputStream.
 
Ranch Hand
Posts: 61
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may also want to check usage of FileWriter

This would be better useful when you need to take some decisions while writing to the file.
 
Ranch Hand
Posts: 87
Java Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In java.nio.channels.FileChannel .... try to find methods for truncating the file content ..
 
Marshal
Posts: 64494
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pradipta kumar rout wrote: . . . I want to delete the previous contents of a file ...
and start to write new strings to the fiel is there any method to doing this . . . .

That is really easy; you already have some useful suggestions.
 
mooooooo ..... tiny ad ....
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!