
Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
> In that case, you can do it with a script copy or with the
> FileTransfer class.
*The* FileTransfer class?
AFAIK there is no such class included as part of any Sun JDK. A Google
search results in at least a handful of classes with that name.
Anyway to the OP: copying a file from one partition to another
requires not more than about 10 lines of code (read from an
InputStream, write to an OutputStream, repeat until EOF, close both).
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Chris Uppal - 16 Nov 2005 14:08 GMT
> Anyway to the OP: copying a file from one partition to another
> requires not more than about 10 lines of code (read from an
> InputStream, write to an OutputStream, repeat until EOF, close both).
Unless you also want to preserve permissions, access times, etc. (Which may
not be the case for the OP.)
-- chris
Gordon Beaton - 16 Nov 2005 13:56 GMT
> Unless you also want to preserve permissions, access times, etc. (Which may
> not be the case for the OP.)
(hmm, didn't think of that)
AFAIK you can't preserve those (or change them after the copy) from within
Java.
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Roedy Green - 16 Nov 2005 15:35 GMT
>*The* FileTransfer class?
the one I mentioned in my previous post
http://mindprod.com/products1.html#FILETRANSFER

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
dwi - 18 Nov 2005 22:33 GMT
Thanks for all the replies so far. I may decide then to write my own
instead.
I looked at CommonsIO, and I can not find any one.
My requirement is actually simpler, ie. within the same server, but
with multiple partitions.
BTW, Anyone can advise on the performance point of view? I heard that
copying file using
the usual InputStream read() and write() is not really efficient,
especially with large file.
Someone suggests using FileChannel class instead. Any suggestion ?
Cheers, Dwi
Benji - 18 Nov 2005 22:39 GMT
> BTW, Anyone can advise on the performance point of view? I heard that
> copying file using
> the usual InputStream read() and write() is not really efficient,
> especially with large file.
> Someone suggests using FileChannel class instead. Any suggestion ?
yes. use a FileChannel. ;-) (it is much more efficient)

Signature
Of making better designs there is no end,
and much refactoring wearies the body.
Luc The Perverse - 19 Nov 2005 00:37 GMT
>> BTW, Anyone can advise on the performance point of view? I heard that
>> copying file using
[quoted text clipped - 3 lines]
>
> yes. use a FileChannel. ;-) (it is much more efficient)
Is that true when doing nothing but reading/streaming a file?
I will take any performance advanced when getting hashes of files on my
drive.
--
LTP
:)