Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can i delete a data of file  RSS feed

 
twity Panu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to delete data of the file and rewrite it.
is it possible in java.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "twity"-

You have been told before that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here. This is not optional - accounts without a proper screen name are generally closed. Change it before your next post.

As to your question, do you want to overwrite an existing file without deleting it first? That can be done by using a FileWriter (or FileOutputStream), and setting the boolean "append" to false in the constructor.
If it's something else youre looking for, post some more detail about the question.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15860
80
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Twity!

First, please change your display name, as Ulf has asked you!

After you changed your name, have a look at the API documentation of class java.io.File. It contains the methods you're looking for.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!