title: How to copy file from SMB share to local drive not in domain with JCIFS
body: <p>I'm trying to copy some remote files to the local drive, in Java, using JCIFS.
  The remote machine is inside a domain. The local machine is <em>not</em> in a domain.</p>
  
  <p>The following code works, but it's <em>really</em> slow (2 minutes for 700Kb... and I have many Mb...):</p>
  
  <pre><code>SmbFile remoteFile = new SmbFile("smb://...")
  OutputStream os = new FileOutputStream("/path/to/local/file");
  InputStream is = remoteFile.getInputStream();
  int ch;
  while ((ch = is.read()) != -1) {
      os.write(ch);
  }
  os.close();
  is.close();
  </code></pre>
  
  <p>I think I could use SmbFile.copyTo(), but I don't know how to access the local file. If I write the following, I get a connection error:</p>
  
  <pre><code>localfile = new SmbFile("file:///path/to/localfile")
  </code></pre>
  
  <p>This question is related to <a href="https://stackoverflow.com/questions/13359164/how-to-copy-file-from-smb-share-to-local-drive-using-jcifs-in-java">How to copy file from smb share to local drive using jcifs in Java?</a></p>