Solved

Reading file from a share folder

Posted on 2001-06-28
4
297 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Groovy problem when using SOAPUI : DispatchException occurred 7 45
tomcat administrtor 12 47
ejb on wildfly 5 20
going to wrong jsp page 2 21
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

777 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