Recursively Monitor Folders with Java 7 NIO.2 filesystem


Using the WatchService interface in the java.nio.file package of JDK 1.7 one can easily monitor a folder recursively for any Creations/Modifications/Deletions. There are many examples available on the internet like this one on Java Blog. The Early access of JDK 1.7 can be obtained from the Oracle website. WatchService API uses the underlying OS filesystem functionalities to deliver the events on the registered folder and does work good on Linux and windows.

Further Reading:

http://java.dzone.com/articles/introducing-nio2-jsr-203-part-2?utm_source=am6_feedtweet&utm_medium=twitter&utm_campaign=toya256ForRSS

http://download.java.net/jdk7/docs/api/java/nio/file/WatchService.html

Advertisements

About Dominic

J for JAVA more about me : http://about.me/dominicdsouza
This entry was posted in Thechy Stuff. Bookmark the permalink.

One Response to Recursively Monitor Folders with Java 7 NIO.2 filesystem

  1. Pingback: Java 7 is here! – Some Ease for Java Programmers | {API LEVEL}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s