I am having problems making a exact copy of a file. It seems that it changes the headers of the file.

I tried using the Apache fileutils copyfile method but it seems to change the header completely. The rest of the file looks pretty much OK.

I think it works but the problem is that the FTP transfer fails.......It generates the copy correctly I think

Any way to do it?

Edited by riahc3: n/a

6 Years
Discussion Span
Last Post by riahc3

Typical roseindia - hardly an expert solution, and more important to this thread, does nothing about the file headers.
riahc3 - have you had a look at the NIO (new I/O) classes in Java 7? They have lots of new stuff for copying files and handing file attributes - even OS-dependent headers.

See especially Files.copy(source, target, COPY_ATTRIBUTES);

Edited by JamesCherrill: n/a


I'm using Java 6 but I solved it: had to set the file type to binary instead of the default of ASCII. My fault.

Votes + Comments
In every thread of yours, you find the solution at the very end yourself!. :P
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.