title: Copying a file using FileUtils.copyFile
body: <p>I am trying to copy files using file utils copy file method. I am running in to some issues where an exception is some times thrown </p>
  
  <p><code>java.io.IOException: Failed to copy full contents from 'path.xml' to localfile.xml</code></p>
  
  <p>I have googled and seen in the code that this exception is thrown when the target file length is different to the destination file length, The exception only occures some times - this could be due to the fact that the file i am trying to copy is consistantly updating so i might catch it mid update(just an xml file with values changing)</p>
  
  <p>If i wrap the call in a <code>if(target.canRead())</code> but this seems to make little difference.</p>
  
  <p>Can anyone help?</p>
  
  <p>*<em>update:</em>*I cannot lock the file as it is being written to via a third party vendor, this would cause all sorts of problems. </p>