Package com.sun.jna.platform

# Class FileMonitor

java.lang.Object
com.sun.jna.platform.FileMonitor

Direct Known Subclasses:
  `W32FileMonitor`

public abstract class FileMonitor extends Object
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 Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `FileMonitor.FileEvent`
  `static interface`
  `FileMonitor.FileListener`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `FILE_ACCESSED`
  `static final int`
  `FILE_ANY`
  `static final int`
  `FILE_ATTRIBUTES_CHANGED`
  `static final int`
  `FILE_CREATED`
  `static final int`
  `FILE_DELETED`
  `static final int`
  `FILE_MODIFIED`
  `static final int`
  `FILE_NAME_CHANGED_NEW`
  `static final int`
  `FILE_NAME_CHANGED_OLD`
  `static final int`
  `FILE_RENAMED`
  `static final int`
  `FILE_SECURITY_CHANGED`
  `static final int`
  `FILE_SIZE_CHANGED`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileMonitor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFileListener(FileMonitor.FileListener listener)`
  `void`
  `addWatch(File dir)`
  `void`
  `addWatch(File dir, int mask)`
  `void`
  `addWatch(File dir, int mask, boolean recursive)`
  `abstract void`
  `dispose()`
  `protected void`
  `finalize()`
  `static FileMonitor`
  `getInstance()`
  `protected void`
  `notify(FileMonitor.FileEvent e)`
  `void`
  `removeFileListener(FileMonitor.FileListener x)`
  `void`
  `removeWatch(File file)`
  `protected abstract void`
  `unwatch(File file)`
  `protected abstract void`
  `watch(File file, int mask, boolean recursive)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FILE_CREATED

    public static final int FILE_CREATED
    See Also:
      - Constant Field Values

  - ### FILE_DELETED

    public static final int FILE_DELETED
    See Also:
      - Constant Field Values

  - ### FILE_MODIFIED

    public static final int FILE_MODIFIED
    See Also:
      - Constant Field Values

  - ### FILE_ACCESSED

    public static final int FILE_ACCESSED
    See Also:
      - Constant Field Values

  - ### FILE_NAME_CHANGED_OLD

    public static final int FILE_NAME_CHANGED_OLD
    See Also:
      - Constant Field Values

  - ### FILE_NAME_CHANGED_NEW

    public static final int FILE_NAME_CHANGED_NEW
    See Also:
      - Constant Field Values

  - ### FILE_RENAMED

    public static final int FILE_RENAMED
    See Also:
      - Constant Field Values

  - ### FILE_SIZE_CHANGED

    public static final int FILE_SIZE_CHANGED
    See Also:
      - Constant Field Values

  - ### FILE_ATTRIBUTES_CHANGED

    public static final int FILE_ATTRIBUTES_CHANGED
    See Also:
      - Constant Field Values

  - ### FILE_SECURITY_CHANGED

    public static final int FILE_SECURITY_CHANGED
    See Also:
      - Constant Field Values

  - ### FILE_ANY

    public static final int FILE_ANY
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### FileMonitor

    public FileMonitor()

- ## Method Details

  - ### watch

    protected abstract void watch(File file, int mask, boolean recursive) throws IOException
    Throws:
      `IOException`

  - ### unwatch

    protected abstract void unwatch(File file)

  - ### dispose

    public abstract void dispose()

  - ### addWatch

    public void addWatch(File dir) throws IOException
    Throws:
      `IOException`

  - ### addWatch

    public void addWatch(File dir, int mask) throws IOException
    Throws:
      `IOException`

  - ### addWatch

    public void addWatch(File dir, int mask, boolean recursive) throws IOException
    Throws:
      `IOException`

  - ### removeWatch

    public void removeWatch(File file)

  - ### notify

    protected void notify(FileMonitor.FileEvent e)

  - ### addFileListener

    public void addFileListener(FileMonitor.FileListener listener)

  - ### removeFileListener

    public void removeFileListener(FileMonitor.FileListener x)

  - ### finalize

    protected void finalize()
    Overrides:
      `finalize` in class `Object`

  - ### getInstance

    public static FileMonitor getInstance()