Class FileWatcher

java.lang.Object
io.jmix.flowui.devserver.FileWatcher

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

    Constructors
    Constructor
    Description
    FileWatcher(com.vaadin.flow.function.SerializableConsumer<File> onChangeConsumer, File watchDirectory)
    Creates an instance of the file watcher for the given directory.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Starts the file watching.
    void
    Stops the file watching.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileWatcher

      public FileWatcher(com.vaadin.flow.function.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