Peter Crowther wrote:
From: David Kerber [mailto:[EMAIL PROTECTED] What is the most efficient (=fastest) way of copying large (> 1GB [yes, that's a Giga]) files around the network in java when running under tomcat 5.5.x? Do I use a FileInputStream and FileOutputStream with a large byte[] array? Or what?

If you *definitely* want efficient, and you're on Windows, then:

- Do not use Java, use OS-level tools;
- Run the tools on the receiving machine, not the sending machine.

You don't have to worry about differences in buffer sizes between the
network and whatever chunking you're using on the Java file copy, and
I'm pretty sure I've seen "copy" pre-allocate the entire file space when
the target file is local (because it knows it's copying a source file
and it knows it has exclusive access, so the size doesn't change).  I've
never seen that behaviour when "copy" is running to a network share.

The easiest way of doing this on Windows is via the AT command: write
yourself an at that runs a couple of minutes in the future (use Java to
look up the time :-) ), similar to:

at \\targetserver 21:02 "c:\jobs\copyFromLive.bat"

Ugly as sin, but it works and it's fast.

                - Peter
Thanks for the suggestion!  I would never have thought of that.

D



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to