Quote:
Originally Posted by OldBlue
This was obviously the wrong forum to post in for timely replies... 
|
Its a long weekend, you can't expect very many people are around :P
FileWriter has five constructors to it:
Code:
public FileWriter(File);
public FileWriter(File, boolean);
public FileWriter(FileDescriptor);
public FileWriter(String);
public FileWriter(String, boolean);
So with the exception of FileDescriptor, providing a boolean as a second argument will flag appending.
An alternative is to write the data files as serialized. The collection is already serialized, so just implement Serializable on the object class within it, and you can just ovewrite the file every time. Useful if things are small, typically for something like configurations, but you never need to worry about appending since it'll always overwrite the entire file (and therefore can accommodate a changing list as well).