Apache Camel SFTP 实现使用 JSch。但是 JSCH 只支持二进制文件传输,我从这个链接了解到:
How to set file type and file transfer mode in JSch?
那么Camel SFTP是如何支持binary
作为URI参数的呢?
https://camel.apache.org/components/latest/sftp-component.html
我的理解有误吗?
答案 0 :(得分:2)
文档很可能是假的。
FtpEndpointConfigurer
和 SftpEndpointConfigurer
确实分别将 binary
参数传播到 FtpConfiguration.setBinary
和 SftpConfiguration.setBinary
。所以从这个意义上说,两者都支持那个参数。
但是,虽然 FtpOperations
查询 FtpConfiguration.isBinary
并相应地设置 FtpClient
模式:
client.setFileType(configuration.isBinary() ? FTP.BINARY_FILE_TYPE : FTP.ASCII_FILE_TYPE);
... SftpConfiguration.isBinary
永远不会被调用。所以永远不会使用配置的值。