• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How to delete the content of a file

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check usage of FileOutputStream.
 
Ranch Hand
Posts: 61
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In java.nio.channels.FileChannel .... try to find methods for truncating the file content ..
 
Marshal
Posts: 76415
365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic