This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes how to delete or modify  the data in file.(not the total file) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "how to delete or modify  the data in file.(not the total file) " Watch "how to delete or modify  the data in file.(not the total file) " New topic
Author

how to delete or modify the data in file.(not the total file)

shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Hi 2 all....
I m new to java .
how to edit the data or delete the data in the files

please reply ..


shiva
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
Read the data from the file and do whatever you want like adding,editing or deleting the data then write it to the same file.

This could be done by using java.io package.

SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Siva Masilamani wrote:Read the data from the file and do whatever you want like adding,editing or deleting the data then write it to the same file.

This could be done by using java.io package.

thanks for the reply ..

i have the outputfile.txt
shiva,20,good
raju,10,good
ramesh,20,bad

i have to modify the data shiva ,20,good to shiva ,40,bad.
I dont want the whole file to be rewirtten . only the data which i modified has to be changed.

My desire output.txt
shiva,40,bad
raju,10,good
ramesh,20,bad.

Note: the whole file should not be rewritten only the data which i modified has to be change

thanks in advance



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to delete or modify the data in file.(not the total file)
 
Similar Threads
Deleting data form a file?
delete a hidden file
deleting text from a file
deleting lines from file
deleting from a file