Reputation: 4266
I'm downloading a file from a FTP account using a self written function:
private boolean download(String path, Path target) throws IOException {
FileOutputStream fos = new FileOutputStream(target.toString());
boolean download = client.retrieveFile(path, fos);
fos.close();
return download;
}
client
is a org.apache.commons.net.ftp.FTPClient
object. Unfortunately the download speed of this function is very very slow. Why is this the case and how can I increase it?
Upvotes: 0
Views: 2254
Reputation: 400
If I'm not wrong, you can try increasing the buffer size of your client object, like this:client.setBufferSize(1024000);
This will decrease the buffer copies on your end, and speed up the download, as commented in SpeedUp FTPClient
Upvotes: 3
Reputation: 4506
Before you do the retrieve, or where you setup your client, try increasing the buffer size.
client.setBufferSize(1024*1024);
Upvotes: 1