How to detect filesystem has changed in java

前端 未结 4 1969
生来不讨喜
生来不讨喜 2021-01-13 21:34

I would like to know how to efficiently implement filesystem changes in java? Say I got a file in a folder and modify that file. I would like to be notified by java about th

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 21:51

    There is an Apache package that does file system monitoring: commons.io.monitor.

    Documentation

    An example

    From what I can tell, you will still need to poll albeit you have control over the frequency.

提交回复
热议问题