file writing

how to write in a file which already contains data in it,without ovrwriting it,ie i want to write in a file step by step without overwriting the previous contents
[169 byte] By [@chillzonea] at [2007-11-27 3:55:20]
# 1
Look at the FileWriter java class. When you create the FileWriter you can choose to create it in "append" mode. http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html
Budyanto.Himawana at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 2

You can try something like this

import java.io.File;

import java.io.FileWriter;

import java.io.IOException;

public class FileAppend {

public FileAppend() {

}

public static void main(String[] args) {

File file = new File("test.txt");

String string = "Testings";

try {

FileWriter outFile = new FileWriter(file,true); // <-- true us the append tihng

outFile.write(string);

outFile.close();

} catch (IOException ioe) {

}

}

}

Caspera at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 3
tanx
@chillzonea at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 4
wht does this true stands for?
@chillzonea at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 5
> wht does this true stands for?true- Append to original filefalse-overwrite to original file(default)
Satish_Patila at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 6
ok its clear for me and no need further explanation
@chillzonea at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 7
what is the difference bteween FileReader and BufferedReader?
@chillzonea at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...
# 8
You mean apart from what it says in the Javadoc?
ejpa at 2007-7-12 8:59:30 > top of Java-index,Java Essentials,New To Java...