Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public void copyFromNetwork(String NetworkFile, String DestinationFile) {
  2. NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("Domain",
  3. "User", "Password");
  4. SmbFile remoteFile;
  5. try {
  6.  
  7. OutputStream os = new FileOutputStream(DestinationFile);
  8.  
  9. InputStream is = null;
  10. is = remoteFile.getInputStream();
  11. int bufferSize = 5096;
  12.  
  13. byte[] b = new byte[bufferSize];
  14. int noOfBytes = 0;
  15. while ((noOfBytes = is.read(b)) != -1) {
  16. os.write(b, 0, noOfBytes);
  17. }
  18. os.close();
  19. is.close();
  20. } catch (Exception ex) {
  21. Log.w("FileCopy", ex);
  22. }
  23. }
  24.  
  25. SmbFile remoteFile;//<-- HERE
  26. try {
  27.  
  28. OutputStream os = new FileOutputStream(DestinationFile);
  29.  
  30. InputStream is = null;
  31. is = remoteFile.getInputStream();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement