This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes file i/o question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "file i/o question" Watch "file i/o question" New topic

file i/o question

daniel schulken
Ranch Hand

Joined: Sep 23, 2000
Posts: 34
am i correct in thanking that the only way to append to a file is using RandomAccessFile?
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi Daniel,
The answer is NO.
Read this from JAVA API
FileWriter :
public FileWriter(String´┐ŻfileName,
boolean´┐Żappend) throws IOException

Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written. Parameters:fileName - String The system-dependent filename.append - boolean if true, then data will be written to the end of the file rather than the beginning.Throws:IOException - if the specified file is not found or if some other I/O error occurs.
You can use as below.
BufferedWriter bw=new BufferedWriter(new FileWriter("Test.txt",true));
This will append you data to the file "Test.txt".
daniel schulken
Ranch Hand

Joined: Sep 23, 2000
Posts: 34
I agree. Here's the link:
subject: file i/o question
Similar Threads
Ant error: Make sure you have it in you classpath
requested resource (first.jsp) not available
Adding a file to a program
File constructor