how to write to file without overwritten the existing content?

Hi,

I want to write a program which has a log file to record every action. I do have the data written to the target file. But every time I run it again the previous log is overwritten!

I tried methods of print, write in classes such as FIleOutputStream, BufferedWriter, PrintStream. And in the sun document I didn't find information about it.

Could anybody help me?

Thanks!

[405 byte] By [rileydonga] at [2007-11-26 16:44:18]
# 1

Look a little harder:

[url=http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileOutputStream.html#FileOutputStream(java.io.File,%20boolean)]FileOutputStream[/url]

[url=http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html#FileWriter(java.io.File,%20boolean)]FileWriter[/url]

DrLaszloJamfa at 2007-7-8 23:11:36 > top of Java-index,Java Essentials,New To Java...
# 2
http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileOutputStream.htmlSee the constructor FileOutputStream(File, boolean). Set the boolean to true to append text to the stream instead of rewriting it.
Loocea at 2007-7-8 23:11:36 > top of Java-index,Java Essentials,New To Java...
# 3
Oh, thanks. It works immediately!!! set a boolean append 'true' and it works~~~~ ^_^
rileydonga at 2007-7-8 23:11:36 > top of Java-index,Java Essentials,New To Java...