copy might not work for you. This only works if both files (the new
and the old one)
are on the same partiton. For example under Linux you cannot copy from /tmp
to /usr/local.
Under Windows you cannot c:\.. to d:\..... The copy method fails under most
circumstances.
Sun has confirmed that this is not a bug because it works the way they
expected.
It's stupid but that's the way it is.
You should open the first file, create the second one and do a binary copy
inside a while loop
to be sure.