ice world

There is nothing too difficult if you put your heart into it.
posts - 104, comments - 103, trackbacks - 0, articles - 0

FTPClient上传文件蜗牛速度的解决方法

Posted on 2013-09-13 16:32 IceWee 阅读(6667) 评论(0)  编辑  收藏 所属分类: Java
Apache Commons的FTPClient局域网上传文件速度本应该很快的,但却在实际开发中发现上传一个文件蜗牛速度,都是因为调用了如下API:

ftpClient.storeFile(fileName, inputStream)

原因是因为默认缓冲区大小是1024,也就是1K,当然慢了,在调用上传API之前重新修改以下默认设置即可,如将缓冲区改为10M,API:

ftpClient.setBufferSize(1024 * 1024 * 10)

只有注册用户登录后才能发表评论。


网站导航: