Top Description Inners Fields Constructors Methods
com.sun.jna.platform

public abstract Class FileMonitor

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.jna.platform.win32.W32FileMonitor
Annotations
@SuppressWarnings:serial
Imports
java.io.File, .IOException, java.util.ArrayList, .EventObject, .HashMap, .List, .Map, com.sun.jna.platform.win32.W32FileMonitor

Provides notification of file system changes. Actual capabilities may vary slightly by platform.

Watched files which are removed from the filesystem are no longer watched.

Author
twall

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
public static interface
private static class
FileMonitor.Holder

Canonical lazy loading of a singleton.

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private List<FileMonitor.FileListener>
private final Map<File, Integer>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
public void
public void
addWatch(File dir, int mask)

public void
addWatch(File dir, int mask, boolean recursive)

public abstract void
protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
public static FileMonitor
protected void
public synchronized void
public void
protected abstract void
unwatch(File file)

protected abstract void
watch(File file, int mask, boolean recursive)

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FILE_ACCESSEDback to summary
public static final int FILE_ACCESSED
FILE_ANYback to summary
public static final int FILE_ANY
FILE_ATTRIBUTES_CHANGEDback to summary
public static final int FILE_ATTRIBUTES_CHANGED
FILE_CREATEDback to summary
public static final int FILE_CREATED
FILE_DELETEDback to summary
public static final int FILE_DELETED
FILE_MODIFIEDback to summary
public static final int FILE_MODIFIED
FILE_NAME_CHANGED_NEWback to summary
public static final int FILE_NAME_CHANGED_NEW
FILE_NAME_CHANGED_OLDback to summary
public static final int FILE_NAME_CHANGED_OLD
FILE_RENAMEDback to summary
public static final int FILE_RENAMED
FILE_SECURITY_CHANGEDback to summary
public static final int FILE_SECURITY_CHANGED
FILE_SIZE_CHANGEDback to summary
public static final int FILE_SIZE_CHANGED
listenersback to summary
private List<FileMonitor.FileListener> listeners
watchedback to summary
private final Map<File, Integer> watched

Constructor Detail

FileMonitorback to summary
public FileMonitor()

Method Detail

addFileListenerback to summary
public synchronized void addFileListener(FileMonitor.FileListener listener)
addWatchback to summary
public void addWatch(File dir) throws IOException
addWatchback to summary
public void addWatch(File dir, int mask) throws IOException
addWatchback to summary
public void addWatch(File dir, int mask, boolean recursive) throws IOException
disposeback to summary
public abstract void dispose()
finalizeback to summary
protected void finalize()

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

getInstanceback to summary
public static FileMonitor getInstance()
notifyback to summary
protected void notify(FileMonitor.FileEvent e)
removeFileListenerback to summary
public synchronized void removeFileListener(FileMonitor.FileListener x)
removeWatchback to summary
public void removeWatch(File file)
unwatchback to summary
protected abstract void unwatch(File file)
watchback to summary
protected abstract void watch(File file, int mask, boolean recursive) throws IOException
com.sun.jna.platform back to summary

public Class FileMonitor.FileEvent

extends EventObject
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final File
private final int
Inherited from java.util.EventObject:
source

Constructor Summary

AccessConstructor and Description
public
FileEvent(File file, int type)

Method Summary

Modifier and TypeMethod and Description
public File
public int
public String
toString()

Overrides java.util.EventObject.toString.

Returns a String representation of this EventObject.
Inherited from java.util.EventObject:
getSource

Field Detail

fileback to summary
private final File file
typeback to summary
private final int type

Constructor Detail

FileEventback to summary
public FileEvent(File file, int type)

Method Detail

getFileback to summary
public File getFile()
getTypeback to summary
public int getType()
toStringback to summary
public String toString()

Overrides java.util.EventObject.toString.

Doc from java.util.EventObject.toString.

Returns a String representation of this EventObject.

Returns:String

a String representation of this EventObject

com.sun.jna.platform back to summary

public Interface FileMonitor.FileListener


Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

fileChangedback to summary
public void fileChanged(FileMonitor.FileEvent e)
com.sun.jna.platform back to summary

private Class FileMonitor.Holder

extends Object
Class Inheritance

Canonical lazy loading of a singleton.

Field Summary

Modifier and TypeField and Description
public static final FileMonitor

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final FileMonitor INSTANCE

Constructor Detail

Holderback to summary
private Holder()