Avoid detecting incomplete files when watching a directory for changes in java

前端 未结 5 661
庸人自扰
庸人自扰 2020-12-31 11:34

I am watching a directory for incoming files (using FileAlterationObserver from apache commons).

class Example implements FileAlterationListener {
    public         


        
5条回答
  •  醉梦人生
    2020-12-31 11:44

    You can check the size of the file 2 or more times in a couple of seconds and if the size is not changing, then you can decide the file change has completed and proceed with your own execution.

提交回复
热议问题