aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: RandomAccessFile -  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: RandomAccessFile -  "rw", "rwd"" Watch "NX: RandomAccessFile -  "rw", "rwd"" New topic
Author

NX: RandomAccessFile - "rw", "rwd"

Terry Martinson
Ranch Hand

Joined: Oct 18, 2003
Posts: 293
I use the RandomAccessFile approach for io. I currently open the raf with mode "rwd". Here is the API info I find for the different modes:

"rw" Open for reading and writing. If the file does not already exist then an attempt will be made to create it.
"rws" Open for reading and writing, as with "rw", and also require that every update to the file's content or metadata be written synchronously to the underlying storage device.
"rwd" Open for reading and writing, as with "rw", and also require that every update to the file's content be written synchronously to the underlying storage device.

I have not worked a lot with RandomAccessFile and am wondering if one is suggested over the others. I did notice in the API description for the "rws" and "rwd" it mentions they may be more efficient.
Thoughts?
TJ


SCJP, SCJD, SCWCD, SCBCD
Jason Mowat
Ranch Hand

Joined: Aug 17, 2003
Posts: 79
I had one issue with RW and RandomAccessFile:

Aside from that issue, I found RW to be quite sufficient.
Cheers,
Jason
Jacques Bosch
Ranch Hand

Joined: Dec 18, 2003
Posts: 319
Yes, good point.
I put the file.exist check in my launch dialog. It has to exist before the server will launch.


Jacques<br />*******<br />MCP, SCJP, SCJD, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: RandomAccessFile - "rw", "rwd"