Now if you look at the source code of tail5 in UNIX, it checks for the existence of inotify1. Java 7 has something similar (but with less features) called the WatchService as part of the NIO.2.
The new way with NIO 2
The part containing the code interfacing with the WatchService of NIO.2 can be found in the FileSystemWatcher java class.You can find the source code to FileSystemWatcher.java on my github account.
Here's the UML schema for the FileSystemWatcher class. (slightly simplified)
Read full article from Random Thoughts on Java Programming: JTail - Java Tail command with NIO 2
No comments:
Post a Comment