title: Checking if file is completely written
body: <p>Currently I'm working on the project that does processing files from source directory in one of it's routines. There's a Java process that's looking for specified directory and tries to read and process files if they exist. Files are quit large and updates by other thirdparty process. The question is how can I check if the file is completely written? I'm trying to use <code>file.length()</code> but looks like even if writing process hasn't been completed it returns actual size. I have a feeling that solution should be platform dependent. Any help would be appreciated.</p>
  
  <p>UPDATE:
  This question is not really different from the duplicate but it has an answer with working code snippet that is highly rated.</p>