file output
Author |
Message |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Euphoracle
![](http://compsci.ca/v3/uploads/user_avatars/11170373664bf5f25f636f1.png)
|
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"); |
|
|
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
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? |
|
|
|
|
![](images/spacer.gif) |
Euphoracle
![](http://compsci.ca/v3/uploads/user_avatars/11170373664bf5f25f636f1.png)
|
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`. |
|
|
|
|
![](images/spacer.gif) |
|
|