Hello Friends ,I have been trying but i am not getting this. I have to modify my client property file every time i.e. i need to overwrite some part of my property file how can do that i have dome like this but not working Here i have to modify NotificationServer part only when i login into the system.pls help me out
The java documentation for FileWriter has the following to say about the constructor that takes a String and a boolean:
public FileWriter(File file, boolean append) throws IOException
Constructs a FileWriter object given a File object. If the second argument is true, then bytes will be written to the end of the file rather than the beginning.
You don't want to write data at the end of the file, right? You have two choices, each has it's plusses and minuses: 1. read the file in, change the data in memory, and write it back out again. You'll have to rename or delete the existing file depending on how you want to deal with exceptions or unforseen problems. 2. use java.io.RandomAccessFile. RandomAccessFile views a file as an array of data. You can write to a point in the "array" and it changes the data in the file. Of course, if you try to write more data than there is space for, you can change data you don't intend to. The Java Tutorial chapter on IO is a good source for more information.