I have a simple Java app that is trying to copy a file across the WAN (from Ireland to NY).
I recently modified it to use FileUtils
because the native Java file copy was too slow. I researched and found that because Fileutils
uses NIO it is better. The file copy now works great but occasionally I need to copy very large files (> 200Mb) and the copy fails with the error:
java.io.IOException: Failed to copy full contents from...
I know the error means that the destination file size is not the same as the source, so initially I figured it was network problems. The process tries repeatedly to copy the file every couple of hours but it is never successful. However, when I copy the file manually through a Windows exploer then it works fine. This would seem to rule out the network...but I'm not really sure.
I have searched but could not find any posts with the exact same issue. Any help would be greatly appreciated.
Thanks!
Addition:
I am using this FileUtils method:
public static void copyFile(java.io.File srcFile, java.io.File destFile) throws java.io.IOException
copyFile
inFileUtils
. If you add some of your code to show exactly what you are doing we could provide more help. – Sheathbill