用SUN的sun.net.ftp包怎么下载很慢?
代码是这样的
public boolean downloadFile(String ftpFileName, String localFileName) {
boolean returnState = false;
if (ConnectState) {
try {
int ch;
File fi = new File(localFileName);
RandomAccessFile getFile = new RandomAccessFile(fi, "rw ");
getFile.seek(0);
TelnetInputStream fget = aftp.get(ftpFileName);
DataInputStream puts = new DataInputStream(fget);
while ((ch = puts.read()) > = 0) {
getFile.write(ch);
}
fget.close();
getFile.close();
logger.info(new StringBuilder().append(ftpFileName).append(gp.getKeyValue( "FtpDownload ")).append(localFileName).toString());
returnState = true;
} catch (
IOException e) {
logger.error(gp.getKeyValue( "FtpDownloadFileNotCreate "));
}
} else {
logger.debug( "ftp服务尚未连接! ");
}
return returnState;
}
很正常的使用,还是在本地局域网中测试,不过就是很慢,要比一般的下载应用程序下载或Delphi写的ftp下载慢多了?为什么?
------解决方案--------------------20分也要