Link to home
Start Free TrialLog in
Avatar of vidyod
vidyod

asked on

Reading file from a share folder

Hi,
I am writing a java program which will read files from a share folder. Since it is a shared folders, users might be writing in to the file.

So before the program going to read the file, I want to check if the files is being accessed by some other process or what?

regards
vidyod
ASKER CERTIFIED SOLUTION
Avatar of jorj
jorj
Flag of Romania 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
Hi,

I don't think you need to do something special about that. Just open a file--if that's a wrong moment, IOException will be thrown. Calls to canRead() etc will not be very helpful--other process/user can open a file between your check and open attempt.

Regards,
Igor Bazarny,
Brainbench MVP for Java 1
www.brainbench.com
Avatar of sudhakar_koundinya
sudhakar_koundinya



No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


--  points to jorj


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
Hmm, I believe canRead()/canWrite() check only file permissions, not sharing status. So, jorj comment don't answer this question IMO.