Link to home
Start Free TrialLog in
Avatar of jjacksn
jjacksn

asked on

How does RandomFileAccess lock at the OS level?

If I open a filed using the RandomFileAccess command and "rw", will the OS stop the file from being written to by any other program?  will a subsequent call using "rw" fail?  

Would this differ between windows and *nix?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jjacksn
jjacksn

ASKER

Ug.... I can't seem to do this simple thing:  

in the simplest case, I want to open a file what to open a file such that no one else can write to it while it is open... I know you can do this in windows, at least.  

However, calling


raf = new RandomAccessFile(fileName, "rw");
raf = new RandomAccessFile(fileName, "rw");

works... so that's not going to do it.  does the normal File object?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jjacksn

ASKER

objects, that's great thanks.
 
I do know, at least in windows, that I've been looking at a file, and then tried to right to it, and it was "locked" by another program.  I don't mind if someone is reading the old data, so long as that don't to write to it until the first method call finished.  Can this be accomplished?  
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial