• Post Reply Bookmark Topic Watch Topic
  • New Topic

fileSystemWatcher  RSS feed

 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know if there is a java Class that can trigger an event handler in response to a filesystem event such as when a file is added, changed, or deleted? The dotNet C++ language ( forgive my filthy mouth) has a class called fileSystemWatcher which does just that. It would be nice to not have to poll the filesystem in a loop in java. It would be nice to have one java file Watcher that behaves the same on both MS and UNIX filesystems.
Thanks.

[ February 09, 2005: Message edited by: john prieur ]
[ February 10, 2005: Message edited by: john prieur ]
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea, this is one of those "you can have your language portable or have fine-grained control on the file system" engineering decisions. When you choose the language for your project, you choose the correct tool for the job. If you need fine-grained control of the file system, Java is probably a bad choice.
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear blabbing fool

I appreciate your humor and your correct point. I'm just hoping to obtain a java class that encapsulates the different filesystem-specific mechanisms for triggering on changes to a file. I could write a JNL class for MS, which would benefit from COM, and I could write a straight java class for UNIX which performs polling within a loop. ...And encapsulate these under a fileSystemWatcher class and build it with the respective filesystem-specific class. But I'm hoping that someone out there already has all this and will let me know where to get it.
Thanks again.
[ February 10, 2005: Message edited by: john prieur ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!