FTPListParseException

使用ftp4这个jar包来连接FTP时,有时会报it.sauronsoftware.ftp4j.FTPListParseException这个异常,究其原因:
The FTP protocol doesn't offer a wide supported method to get complete informations about the contents of the working directory. The LIST command usually gives all you need to know, but unfortunately every server can use a different style for the response. It means that some servers return a UNIX style directory listing, some servers prefer the DOS style, others use some alternative ones.
解决办法:
1 设置FTP服务器的选项。
UNIX style and variants (i.e. MAC style)
DOS style
NetWare styles
EPLF
MLSD
2 使用 listNames()代替list()放过。
3 使用list(String str)这个方法进行过滤。
这三个方法中第一个最好,但是有时候FTP服务器不是你能控制到的,所以可以选择第二个。第三个呢,因为有过滤功能,除非你知道你想要的是什么,否则你加了过滤条件后就会减少你获得的信息。主张用第二个方法。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

链诸葛

真爱了。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值