Java Apache Ftp检索文件未下载大文件
我试图检索大小为1 GB的文件(.dat),但是,从服务器检索一些字节后,它显示没有Ftp连接服务器,但是,该程序不会抛出错误并挂起,我的代码对于小文件运行得很好,但是对于大文件它失败Java Apache Ftp检索文件未下载大文件,java,apache,ftp,apache-commons,apache-commons-net,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 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);`