This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes adding to files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "adding to files" Watch "adding to files" New topic
Author

adding to files

Tersa
Greenhorn

Joined: Nov 26, 2003
Posts: 10
how do i add something to files so that the old data is not overwrited??
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8935
    
    9

Use
FileOutputStream(String name, boolean append)
or
FileWriter(String name, boolean append)
with true as the second argument.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Tersa,
Thank you for changing your name from COOL angel! However, according to the naming policy, you must have a first and a last name. It doesn't have to be your real last name, just a real looking one. Please head over here and make this last change.
Thanks!
 
 
subject: adding to files