|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jniwrapper.win32.io.FileSystemWatcher
public class FileSystemWatcher
FileSystemWatcher class is designed to listen for file system events in a specified folder with various watching parameters.
It uses different watching strategies depending on OS. For NT systems, it automatically sets upWinNTWatcherStrategy
and
for Win9x, it automatically sets up Win9xWatcherStrategy
. Also, it
can use other strategies derived from WatcherStrategy
.
Nested Class Summary | |
---|---|
class |
FileSystemWatcher.WatcherOptions
WatcherOptions class determines a set of properties to configure the behavior of FileSystemWatcher . |
Constructor Summary | |
---|---|
FileSystemWatcher(java.lang.String path)
Creates a new instance to watch for modifications in a given folder. |
|
FileSystemWatcher(java.lang.String path,
boolean watchSubree)
Creates a new watcher to watch for modifications in a given path. |
|
FileSystemWatcher(java.lang.String path,
java.io.FileFilter fileFilter)
Creates a new instance to watch for modifications in a given folder. |
|
FileSystemWatcher(java.lang.String path,
java.io.FileFilter fileFilter,
boolean watchSubree)
Creates a new instance to watch for modifications in a given folder. |
Method Summary | |
---|---|
void |
addFileSystemListener(FileSystemEventListener listener)
Adds FileSystemEventListener |
protected WatcherStrategy |
createStrategy(java.lang.Class strategyClass)
Creates an instance of the watching strategy from the specified class. |
protected void |
fireFileSystemEvent(FileSystemEvent event)
Sends specified event to all listeners that was added to this watcher |
java.io.FileFilter |
getFileFilter()
Returns file filter |
FileSystemWatcher.WatcherOptions |
getOptions()
Returns FileSystemWatcher.WatcherOptions that contains a set of notify filters. |
java.lang.String |
getPath()
Returns watched folder path |
boolean |
isWatching()
Returns true if the watcher is watching a specified folder, otherwise false. |
boolean |
isWatchSubree()
Returns true if the watcher is configured to watch the subtree, otherwise false. |
void |
removeFileSystemListener(FileSystemEventListener listener)
Removes FileSystemEventListener |
void |
setStrategy(java.lang.Class strategyClass)
Sets up a custom watching strategy. |
void |
start()
Starts watching. |
void |
stop()
Stops watching. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileSystemWatcher(java.lang.String path)
path
- a folder to watchpublic FileSystemWatcher(java.lang.String path, java.io.FileFilter fileFilter, boolean watchSubree)
path
- a folder to watch.fileFilter
- specifies the files or folders to be watched.watchSubree
- tells the watcher whether or not to watch the folder's subtree.public FileSystemWatcher(java.lang.String path, java.io.FileFilter fileFilter)
path
- the folder to watch.fileFilter
- specifies the files or folders to be watched.public FileSystemWatcher(java.lang.String path, boolean watchSubree)
path
- the folder to watch.watchSubree
- if true, sub-directories will also be monitored.Method Detail |
---|
public void setStrategy(java.lang.Class strategyClass)
strategyClass
- a custom strategy class derived from WatcherStrategy
protected WatcherStrategy createStrategy(java.lang.Class strategyClass)
strategyClass
- a custom strategy class derived from WatcherStrategy
public java.lang.String getPath()
public java.io.FileFilter getFileFilter()
public boolean isWatchSubree()
public FileSystemWatcher.WatcherOptions getOptions()
FileSystemWatcher.WatcherOptions
that contains a set of notify filters.
FileSystemWatcher.WatcherOptions
that contains a set of notify filters.public void addFileSystemListener(FileSystemEventListener listener)
FileSystemEventListener
listener
- File system listenerpublic void removeFileSystemListener(FileSystemEventListener listener)
FileSystemEventListener
listener
- File system event listenerprotected void fireFileSystemEvent(FileSystemEvent event)
event
- File system eventpublic void start() throws FileSystemException
FileSystemException
public void stop() throws FileSystemException
FileSystemException
public boolean isWatching()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |