Right - I think I misunderstood. If we're talking about error checking and file integrity and not security, then this is handled on the internet by the TCP protocol. This protocol ensures all packets sent arrive at the destination and are reassembled correctly. Downloads being corrupted on transfer should never happen.
https://en.wikipedia.org/wiki/Transmission_Control_Protocol
Like Martin said - to be completely secure in knowing the transferred file is the same as the original, one can use file checksums. This is usually to protect against man-in-the-middle attacks, not because the file transfer over TCP can't be trusted. You would create a checksum of the file on both ends and compare them.
This would require some lines of scripting but would still require a LOT less code than doing the whole thing from scratch in Java.
If going the scriping route, you could also consider using Rsync instead, it is available on Windows in for instance Cygwin. Rsync has a "--checksum" option.
https://en.wikipedia.org/wiki/Rsync
https://en.wikipedia.org/wiki/Transmission_Control_Protocol
Like Martin said - to be completely secure in knowing the transferred file is the same as the original, one can use file checksums. This is usually to protect against man-in-the-middle attacks, not because the file transfer over TCP can't be trusted. You would create a checksum of the file on both ends and compare them.
This would require some lines of scripting but would still require a LOT less code than doing the whole thing from scratch in Java.
If going the scriping route, you could also consider using Rsync instead, it is available on Windows in for instance Cygwin. Rsync has a "--checksum" option.
https://en.wikipedia.org/wiki/Rsync