Java Apache Ftp retrieveFile没有下载大文件

时间:2015-01-05 20:02:18

标签: java apache ftp apache-commons apache-commons-net

我尝试检索大小为 1 GB 的文件(.dat),但是,从服务器检索了一些字节后,它显示否连接Ftp 服务器,但是,这个程序没有抛出错误并挂起,我的代码对于小文件运行得很好但是,对于大文件它会失败
代码如下

//Ftp Connection  
ftpClient.connect(server, port);  
ftpClient.login(username, password);  
ftpClient.enterLocalPassiveMode();  
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);

//File Downloading
File downloadFile = new File(savePath);
OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(downloadFile));
isFileDownloaded= ftpClient.retrieveFile(remoteFilePath, outputStream);`

0 个答案:

没有答案