当前位置:   article > 正文

FTPClien文件流传输ftpClient.retrieveFileStream(remoteFileName)_ftpclient.retrievefilestream用法

ftpclient.retrievefilestream用法

最近需要使用到ftp传输,调用了FTPClient,但是在调用retrieveFileStream(remotename)方法时,发现当一次连接只下载一个文件没问题,但是一次连接下载多个文件时会出现空指针异常,查阅资料找到这些,整理如下做个记录:

/*  

* You must close the InputStream when you  

* finish reading from it. The InputStream itself will take care of  

* closing the parent data connection socket upon being closed. To  

* finalize the file transfer you must call  

* {@link #completePendingCommand completePendingCommand } and  

* check its return value to verify success.  

*/

调用顺序:

in=ftpClient.retrieveFileStream(localFile.getName());
     。。。。

in.close();
ftpClient.completePendingCommand();



声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/255573
推荐阅读
相关标签
  

闽ICP备14008679号