File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RandomAccessFile mode 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 "RandomAccessFile mode" Watch "RandomAccessFile mode" New topic
Author

RandomAccessFile mode

rinke hoekstra
Ranch Hand

Joined: Apr 06, 2007
Posts: 152
Hi all,

What mode to use on RandomAccessFile? It seems quite some people are using "rwd" or "rws", but I have the feeling "rw" is enough.

I've read this thread:
http://www.coderanch.com/t/184847/java-developer-SCJD/certification/NX-RandomAccessFile-mode


But I'm still rather confused on it, as this thread doesn't seem to give a complete overview of all advantages and disadvantages.

Rinke
[ July 13, 2007: Message edited by: rinke hoekstra ]

_ _ ________________________ _ _ <br /> <br />Just SCJP (but 93%)
John Stone
Ranch Hand

Joined: May 04, 2007
Posts: 332
I think, that this is not needed for exam.
rinke hoekstra
Ranch Hand

Joined: Apr 06, 2007
Posts: 152
Originally posted by John Stone:
I think, that this is not needed for exam.




Why not? If you're using RandomAccessFile, you will need to create that object via its constructor, so you will need to decide whether you construct RandomAccessFile with "rw", "rwd" or "rws". So if you are using RandomAccessFile this is part of the exam.
John Stone
Ranch Hand

Joined: May 04, 2007
Posts: 332
It should not matter which one you use. There is no requirement, that we should think about data being corrupted by e.g. power outage.
Following this way, you may also find yourself implementing some kind of journal log to be able to recover from corrupted database and that is surely not needed.
rinke hoekstra
Ranch Hand

Joined: Apr 06, 2007
Posts: 152
OK John,

thanks for clarifying.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RandomAccessFile mode