That's not the proper way to copy a file. InputStream.read(byte) can read fewer bytes than you intend. If that is the case the remainder of the byte will contain 0 bytes. This may very well be the cause of the corruption.
The solution is of course to use a loop: