user3649361
user3649361

Reputation: 954

Not able to download a large file in java ftp

I am working on a project in JavaFX. I need to download a file from the server for that I am using the ftp connection and downloading the file. The size of the file is 560 MB, while downloading the file the code doesn't give any error but when I check the size of the file in the download location it is only 485 MB and I am not able to open it.

My code for downloading is:

OutputStream output = new FileOutputStream(toPath + "/" + dfile);
if(ftpClient.retrieveFile(dfile, output))
{
    downloadButton.setDisable(true);
}
output.close();

Does java ftp have some download file size limit? How to resolve this problem? I have heard of chunking but don't know how to implement it in this case.

Upvotes: 1

Views: 1562

Answers (1)

user3649361
user3649361

Reputation: 954

I downloaded the files in binary mode and it's working fine now.

ftpClient.setFileType(FTP.BINARY_FILE_TYPE)

Upvotes: 2

Related Questions