Class FileWatcher

java.lang.Object
com.vaadin.base.devserver.FileWatcher

public class FileWatcher extends Object
Watches for the file or sub-directory changes in the given directory.
  • Constructor Details

    • FileWatcher

      public FileWatcher(SerializableConsumer<File> onChangeConsumer, File watchDirectory) throws IOException
      Creates an instance of the file watcher for the given directory.

      Reports the changed file or directory as a File instance to the provided consumer.

      Watches the files create/delete and directory create/delete events.

      Parameters:
      onChangeConsumer - to be called when any change detected
      watchDirectory - the directory to watch for changes, cannot be empty
      Throws:
      IOException
  • Method Details

    • start

      public void start()
      Starts the file watching.
    • stop

      public void stop() throws IOException
      Stops the file watching.
      Throws:
      IOException - if an error occurs during stop