PollingDirectoryWatcher (Grails 6.0.0)

Package: org.grails.io.watch

## [Java] Class PollingDirectoryWatcher

- org.grails.io.watch.PollingDirectoryWatcher

-     class PollingDirectoryWatcher
      extends AbstractDirectoryWatcher

  Implementation of a AbstractDirectoryWatcher that uses polling. This implementation is used where java.nio.WatchService isn't available (pre Java 7).

  Authors:
    Craig Andrews
  Since:
    2.4
  See Also:
    WatchServiceDirectoryWatcher
    DirectoryWatcher

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private java.util.Map<java.io.File, java.util.Collection<java.lang.String>>` | `directoryToExtensionsMap` |
    `private java.util.Map<java.io.File, java.lang.Long>` | `directoryWatch` |
    `private java.util.Collection<java.lang.String>` | `extensions` |
    `private java.util.Map<java.io.File, java.lang.Long>` | `lastModifiedMap` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class AbstractDirectoryWatcher` | `active, listeners, sleepTime`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `private void` | `addExtensions(java.util.Collection<java.lang.String> toAdd)`
    `` | `public void` | `addWatchDirectory(java.io.File dir, java.util.List<java.lang.String> fileExtensions)`
    `` | `public void` | `addWatchFile(java.io.File fileToWatch)`
    `` | `private void` | `cacheFilesForDirectory(java.io.File directory, java.util.Collection<java.lang.String> fileExtensions, boolean fireEvent)`
    `` | `private void` | `checkForNewFiles()`
    `` | `private java.lang.String` | `removeStartingDotIfPresent(java.lang.String extension)`
    `` | `public void` | `run()`
    `` | `private void` | `trackDirectoryExtensions(java.io.File dir, java.util.List<java.lang.String> fileExtensions)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractDirectoryWatcher` | `addListener, addWatchDirectory, addWatchFile, fireOnChange, fireOnNew, getFilenameExtension, isValidDirectoryToMonitor, isValidFileToMonitor, removeListener, setActive, setSleepTime`

- - ### Field Detail

    - #### private java.util.Map<java.io.File, java.util.Collection<java.lang.String>> directoryToExtensionsMap

    - #### private java.util.Map<java.io.File, java.lang.Long> directoryWatch

    - #### private java.util.Collection<java.lang.String> extensions

    - #### private java.util.Map<java.io.File, java.lang.Long> lastModifiedMap

  - ### Method Detail

    - #### private void addExtensions(java.util.Collection<java.lang.String> toAdd)

    - #### @java.lang.Override public void addWatchDirectory(java.io.File dir, java.util.List<java.lang.String> fileExtensions)

    - #### @java.lang.Override public void addWatchFile(java.io.File fileToWatch)

    - #### private void cacheFilesForDirectory(java.io.File directory, java.util.Collection<java.lang.String> fileExtensions, boolean fireEvent)

    - #### private void checkForNewFiles()

    - #### private java.lang.String removeStartingDotIfPresent(java.lang.String extension)

    - #### @java.lang.Override public void run()

    - #### private void trackDirectoryExtensions(java.io.File dir, java.util.List<java.lang.String> fileExtensions)