[jcifs] File transfers using jcifs

Benoit Daviaud benda472 at student.liu.se
Fri May 16 21:25:00 EST 2003


Hej,

I am writing a program that download a remotly shared file using this API. Currently the only way I found was to read from the SmbFileInputStream and write to a fileOutputStream in a loop with a buffer in between. This is not the most efficient way, but I couldn't manage to use the nio package facilities (the transfertTo method in FileChannel which is hardward optimized. Indeed I couldn't get a channel on the SmbFile. Never the less it works although it takes a little bit more CPU resource. 
My first question is : does anybody know a better way to do that ?

My second question is related to an additionnal feature of my program. It allows the user to interrupt the download and then continue it later. The problem is that to restart the download at the point I stopped it, I have to skip the beginning using the skip method in SmbFileInputStream. It looks like this function has not been reimplemented from InputStream, so what it does is that it downloads the beginning of the file and discards it. This is really not efficient and for example if the user doanload for 20 minutes and then interrupts, he will have to wait 20 minutes again before continuing . This make this interruptability of the download sensless as it is the same as restarting it ...
So my second question is : is there a wait to skip the beginning of the file more quickly with the current release of jcifs ? Or do we have to wait for a futur release ?

Thanks a lot

Benoit
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list