I think RandomAccessFile is correct as that is the only method to update anything in the file (in a non-sequential manner). All streams, readers and writers access file sequentially. Append can be done by all of them. Any comments? Savithri
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I think u can modify a file using all three above.U cannot use a OutputStream,but a subclass of it,namely FileOutputStream.Random AccessFile is used for non sequential access and the other two will be used for sequential access. I hope I have been clear enough. ------------------ Come on in !! Drinks are on the house in the Big Moose Saloon !!
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Oh yes,appending can be done using all three also,as u can pass a FileInputStream cons. in the append mode to a DataInputStream.
Michal Harezlak
Ranch Hand
Joined: Jul 06, 2000
Posts: 185
posted
0
Originally posted by WaliM: With which I/O operation can we append. update a file?
OutputStream is an abstract class. What's more I would risk the theory that it has nothing to do with files as well as the DataOutputStream. Therefore the only answer that makes sense is RandomAccessFile. OutputStream has no constructor with the signature OutputStream(String name, Boolean append), you might be thinking about FileOutputStream.