slow ftp in java using:org.apache.commons.net.ftp
807589Nov 11 2008 — edited Nov 11 2008I am FTPing using the library "org.apache.commons.net.ftp" but its taking a lot of time, can anyone tell me that is there anything wrong with my code that is decreasing the transfer rate OR any other method for FTP in java?
My Code is :
localInputStream = new BufferedInputStream(new FileInputStream(filepath));
OutputStream remoteOutputStream = null;
remoteOutputStream = ftp.storeFileStream(fileName);
BufferedOutputStream bufferedRemoteOutputStream = new BufferedOutputStream(remoteOutputStream );
// Actual transfer of the data file
byte[] buf = null; // output buffer
int bufLen = ftpbuffer * 1024;
buf = new byte[bufLen];
int len = 0;
int r = 0;
int br = 0;
while ((len = localInputStream.read(buf, 0, bufLen)) != -1)
{
r++;
bufferedRemoteOutputStream.write(buf, 0, len);
br = br + len;
}
finally {
if (ftp.completePendingCommand())
{...
....
...
}