Package ghidra.framework.main.logviewer.ui

# Class FileWatcher

java.lang.Object
ghidra.framework.main.logviewer.ui.FileWatcher

public class FileWatcher extends Object
The FileWatcher *watches* a single file and fires a change notification whenever the file is modified. A couple notes: 1. To keep from processing change events every time the file is modified, which may be too frequent and cause processing issues, we use a simple polling mechanism. 2. Changes in the file are identified by inspecting the `File.lastModified()` timestamp. 3. The `WatchService` mechanism is not being used here since we cannot specify a polling rate.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileWatcher(File file, FVEventListener eventListener)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `start()`
  Starts polling, or resumes polling if previously stopped.
  `void`
  `stop()`
  Suspends the timer so it will no longer poll.

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

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

- ## Constructor Details

  - ### FileWatcher

    public FileWatcher(File file, FVEventListener eventListener)
    Constructor. Creates a new `Executor` that will inspect the file at regular intervals. Users must call `start()` to begin polling.
    Parameters:
      `file` - the file to be watched

- ## Method Details

  - ### stop

    public void stop()
    Suspends the timer so it will no longer poll. This does not perform a shutdown, so the future may be scheduled again.

  - ### start

    public void start()
    Starts polling, or resumes polling if previously stopped.