file output
Author |
Message |
HeavenAgain
|
Posted: Thu Nov 01, 2007 11:23 pm Post subject: file output |
|
|
whats the standard file output for java now?
i'm using PrintWriter + BufferedWriter + FileWriter is it out dated?
and another question for PrintWriter, if i were to use it to write a file, it will always start at the beginning of the file, but say theres already something in the file, and i dont want to over write it, how do i skip all those and go to the end? any special method? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Euphoracle
|
Posted: Fri Nov 02, 2007 2:50 pm Post subject: RE:file output |
|
|
You can just do something like
PrintStream pr = new PrintStream(new FileWriter(...));
pr.println("Bacon");
pr.print("eg");
pr.print("gs\n"); |
|
|
|
|
|
HeavenAgain
|
Posted: Fri Nov 02, 2007 3:10 pm Post subject: RE:file output |
|
|
what about skipping to the end of the file instead of over writing? |
|
|
|
|
|
Euphoracle
|
Posted: Fri Nov 02, 2007 5:41 pm Post subject: RE:file output |
|
|
Add the argument `append` (second one for FileWriter contructor) the value of `true`. |
|
|
|
|
|
|
|