I have a Java application that monitors a folder for incoming XML files. When a new file is detected I need to test the file that it is not currently being updated and is closed. My thought is to use File.canWrite() to test this. Is there any issue with doing this? Is this a good way to test that a file has been completely written?
Other ideas I am throwing around are:
- Parse the incoming XML file and test that the closing tag is there.
- Check for the EoF character.
I just am not sure that any of these methods will handle all scenarios.