Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RandomAccessFile - which mode? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RandomAccessFile - which mode?" Watch "RandomAccessFile - which mode?" New topic

RandomAccessFile - which mode?

Dan Murphy
Ranch Hand

Joined: Mar 29, 2005
Posts: 126

In my design I have multiple instances of Data, each of which uses a RandomAccessFile to read the database file. It seems to me that using RandomAccessFile mode "rws" (or "rwd") rather than "rw" will greatly simplify concurrent file access, when there are multiple instances of RandomAccessFile writing to the same file, because a client knows that as soon as a file-updating method has returned, other clients will be able to see the changes. But the consensus in this thread seems to be that "rw" is sufficient, can someone explain why?


I agree. Here's the link:
subject: RandomAccessFile - which mode?
Similar Threads
Why FileOutputStream cann't create an empty file in following statement
Help me about RandomAccessFile
Random Access File modes
Using Random access file to write to a file with long absolute path take long time in unix
NX: RandomAccessFile - "rw", "rwd"