Lines 57-62
Link Here
|
57 |
import java.io.BufferedOutputStream; |
57 |
import java.io.BufferedOutputStream; |
58 |
import java.io.File; |
58 |
import java.io.File; |
59 |
import java.io.FileInputStream; |
59 |
import java.io.FileInputStream; |
|
|
60 |
import java.io.FileNotFoundException; |
60 |
import java.io.FileOutputStream; |
61 |
import java.io.FileOutputStream; |
61 |
import java.io.IOException; |
62 |
import java.io.IOException; |
62 |
import java.io.InputStream; |
63 |
import java.io.InputStream; |
Lines 394-400
Link Here
|
394 |
{ |
395 |
{ |
395 |
if (monitor!=null){ |
396 |
if (monitor!=null){ |
396 |
if (monitor.isCanceled()) { |
397 |
if (monitor.isCanceled()) { |
397 |
return null; |
398 |
return new FTPHostFile(remoteParent,fileName, false, false, 0, 0, false); |
398 |
} |
399 |
} |
399 |
} |
400 |
} |
400 |
|
401 |
|
Lines 680-695
Link Here
|
680 |
|
690 |
|
681 |
IHostFile remoteHostFile = getFile(remoteParent,remoteFile,null); |
691 |
IHostFile remoteHostFile = getFile(remoteParent,remoteFile,null); |
682 |
|
692 |
|
683 |
if(remoteHostFile == null) |
|
|
684 |
{ |
685 |
return false; |
686 |
} |
687 |
|
688 |
if(!remoteHostFile.exists()) |
689 |
{ |
690 |
throw new RemoteFileIOException(new Exception(FTPServiceResources.FTPService_FTP_File_Service_Not_Found)); |
691 |
} |
692 |
|
693 |
if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) |
693 |
if(_commandMutex.waitForLock(monitor, Long.MAX_VALUE)) |
694 |
{ |
694 |
{ |
695 |
try |
695 |
try |
Lines 703-723
Link Here
|
703 |
|
703 |
|
704 |
ftpClient.changeWorkingDirectory(remoteParent); |
704 |
ftpClient.changeWorkingDirectory(remoteParent); |
705 |
setFileType(isBinary); |
705 |
setFileType(isBinary); |
706 |
if (!localFile.exists()) |
|
|
707 |
{ |
708 |
File localParentFile = localFile.getParentFile(); |
709 |
if (!localParentFile.exists()) |
710 |
{ |
711 |
localParentFile.mkdirs(); |
712 |
} |
713 |
localFile.createNewFile(); |
714 |
} |
715 |
|
706 |
|
716 |
output = new FileOutputStream(localFile); |
|
|
717 |
input = ftpClient.retrieveFileStream(remoteFile); |
707 |
input = ftpClient.retrieveFileStream(remoteFile); |
718 |
|
708 |
|
719 |
if(input != null) |
709 |
if(input != null) |
720 |
{ |
710 |
{ |
|
|
711 |
if (!localFile.exists()) |
712 |
{ |
713 |
File localParentFile = localFile.getParentFile(); |
714 |
if (!localParentFile.exists()) |
715 |
{ |
716 |
localParentFile.mkdirs(); |
717 |
} |
718 |
localFile.createNewFile(); |
719 |
} |
720 |
|
721 |
output = new FileOutputStream(localFile); |
721 |
progressMonitor.init(0, remoteFile, localFile.getName(), remoteHostFile.getSize()); |
722 |
progressMonitor.init(0, remoteFile, localFile.getName(), remoteHostFile.getSize()); |
722 |
byte[] buffer = new byte[4096]; |
723 |
byte[] buffer = new byte[4096]; |
723 |
int readCount; |
724 |
int readCount; |
Lines 740-751
Link Here
|
740 |
output.close(); |
741 |
output.close(); |
741 |
|
742 |
|
742 |
ftpClient.completePendingCommand(); |
743 |
ftpClient.completePendingCommand(); |
|
|
744 |
|
745 |
} |
746 |
else |
747 |
{ |
748 |
throw new RemoteFileIOException(new Exception(ftpClient.getReplyString())); |
743 |
} |
749 |
} |
744 |
} |
750 |
} |
745 |
catch (Exception e) |
751 |
catch (FileNotFoundException e) |
|
|
752 |
{ |
753 |
throw new RemoteFileIOException(e); |
754 |
} |
755 |
catch (IOException e) |
746 |
{ |
756 |
{ |
747 |
throw new RemoteFileIOException(e); |
757 |
throw new RemoteFileIOException(e); |
748 |
} finally |
758 |
} |
|
|
759 |
finally |
749 |
{ |
760 |
{ |
750 |
_commandMutex.release(); |
761 |
_commandMutex.release(); |
751 |
} |
762 |
} |