package com.guanghui.wechat.employee.common; import com.jcraft.jsch.*; import java.io.*; import java.util.Properties; public class SftpUtil { private ChannelSftp sftp = null; private Session sshSession = null; private String username; private String password; private String host; private int port; public SftpUtil(String username, String password, String host, int port) { this.username = username; this.password = password; this.host = host; this.port = port; } /** * 连接sftp服务器 * * @return ChannelSftp sftp连接实例 */ public ChannelSftp connect() { info("-->sftp连接开始>>>>>> " + host + ":" + port + " >>>username=" + username); JSch jsch = new JSch(); try { jsch.getSession(username, host, port); sshSession = jsch.getSession(username
java实现从sftp上下载文件
最新推荐文章于 2024-05-08 19:00:00 发布