Apache Camel 如何通过 SFTP 支持 ASCII 模式文件传输?

时间:2021-05-06 14:25:05

标签: java apache-camel sftp jsch

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

我的理解有误吗?

1 个答案:

答案 0 :(得分:2)

文档很可能是假的。

  • FtpEndpointConfigurerSftpEndpointConfigurer 确实分别将 binary 参数传播到 FtpConfiguration.setBinarySftpConfiguration.setBinary。所以从这个意义上说,两者都支持那个参数。

  • 但是,虽然 FtpOperations 查询 FtpConfiguration.isBinary 并相应地设置 FtpClient 模式:

    client.setFileType(configuration.isBinary() ? FTP.BINARY_FILE_TYPE : FTP.ASCII_FILE_TYPE);
    
  • ... SftpConfiguration.isBinary 永远不会被调用。所以永远不会使用配置的值。