[jcifs] Copying Files to different Servers

Christopher R. Hertel crh at ubiqx.mn.org
Sun Jan 11 03:17:25 GMT 2004


Joe Eugene wrote:
> 
> I am able to use following code to copy files.. buts its very slow.
> Is there something i am doing wrong?
> 
>  jcifs.Config.setProperty( "wins", "123.11.22.33");
> 
>  SmbFileInputStream in = new SmbFileInputStream(
>   "smb://username:password@Server/d$/inetpub/wwwroot/images/myImg.jpg" );
> 
>  SmbFileOutputStream out = new SmbFileOutputStream(
>    "smb://username:password@stork/c$/temp/myImg.jpg");
>  int c;
>  while((c = in.read()) != -1)
>   out.write(c);
> 
>  jcifs.Config.setProperty( "wins", "123.11.22.33");
> 
>  Is Wins the IP Addess of the domain?

No, WINS is the address of the NBNS (the NetBIOS Name Server).  It is used
to figure out the IP address of SERVER and STORK.

>  Is there a way to speed this up?

You are reading one character at a time and writing one character at a
time.  You should be reading and writing whole blocks of data at a time. 
There's no need to do that, however, since jCIFS already has a copyTo()
method.

See the example code in examples/CopyTo.java

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the jcifs mailing list