File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to determine weather a file is in use?

 
vijay mahendra
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

how to determine whether file is in use?

using java code.Please help me in this.
Thanks,
Vijay
 
Sev Zaslavsky
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay, what do you mean by "in use"? Is it the same as "cannot be written?" java.io.File class has some methods for determining the status of files.
 
Neha Kathuriaa
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are those methods?
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you familiar with the Java API documentation?
If you want to know if a file is being written, you can watch for a change in the file size. I'm not aware of any way to tell if a file is being read.
It is possible to do file locking with Java. Depending on your requirements, that may be an option.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic