How to detect filesystem has changed in java

前端 未结 4 1889
生来不讨喜
生来不讨喜 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:40

    Take a look at JNotify, which performs this type of monitoring.

    Java 7 will have some more advanced APIs (WatchService) for this sort of work which will eliminate polling on the OSes that support this.

提交回复
热议问题