Interface Watcher

All Known Implementing Classes:
DelayWatcher, IgnoreWatcher, LineReadWatcher, SimpleWatcher, WatcherChain

public interface Watcher
观察者(监视器)
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onCreate(WatchEvent<?> event, Path currentPath)
    文件创建时执行的方法
    void
    onDelete(WatchEvent<?> event, Path currentPath)
    文件删除时执行的方法
    void
    onModify(WatchEvent<?> event, Path currentPath)
    文件修改时执行的方法 文件修改可能触发多次
    void
    onOverflow(WatchEvent<?> event, Path currentPath)
    事件丢失或出错时执行的方法
  • Method Details

    • onCreate

      void onCreate(WatchEvent<?> event, Path currentPath)
      文件创建时执行的方法
      Parameters:
      event - 事件
      currentPath - 事件发生的当前Path路径
    • onModify

      void onModify(WatchEvent<?> event, Path currentPath)
      文件修改时执行的方法 文件修改可能触发多次
      Parameters:
      event - 事件
      currentPath - 事件发生的当前Path路径
    • onDelete

      void onDelete(WatchEvent<?> event, Path currentPath)
      文件删除时执行的方法
      Parameters:
      event - 事件
      currentPath - 事件发生的当前Path路径
    • onOverflow

      void onOverflow(WatchEvent<?> event, Path currentPath)
      事件丢失或出错时执行的方法
      Parameters:
      event - 事件
      currentPath - 事件发生的当前Path路径