Solved

Reading file from a share folder

Posted on 2001-06-28
4
295 Views
Last Modified: 2010-05-19
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
0
Comment
Question by:vidyod
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
jorj earned 100 total points
ID: 6237155
File.canRead(), File.canWrite(), File.exists() are the methods for you. The OS will check for you.
0
 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 6239118
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
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 8950883


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.
0
 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 8958186
Hmm, I believe canRead()/canWrite() check only file permissions, not sharing status. So, jorj comment don't answer this question IMO.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Increment alphanumeric sequence 6 80
bunnyEars challenge 6 65
topping1 challenge 7 53
Requested array size exceeds VM limit 3 50
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now