sftp上传实现

This commit is contained in:
laoyuyu
2020-01-18 10:00:06 +08:00
parent 50b265f22a
commit d217ebcb25
59 changed files with 1616 additions and 387 deletions

View File

@@ -78,7 +78,7 @@ public class SFtpUtil {
}
}
setknowHost(jSch, entity);
setKnowHost(jSch, entity);
Session session;
if (TextUtils.isEmpty(entity.user)) {
@@ -94,14 +94,14 @@ public class SFtpUtil {
// 不检查公钥需要在connect之前配置但是不安全no 模式会自动将配对信息写入know_host文件
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);// 为Session对象设置properties
session.setTimeout(3000);// 设置超时
session.setTimeout(5000);// 设置超时
session.setIdentityRepository(jSch.getIdentityRepository());
session.connect();
SFtpSessionManager.getInstance().addSession(session, threadId);
return session;
}
private void setknowHost(JSch jSch, FtpUrlEntity entity) throws JSchException {
private void setKnowHost(JSch jSch, FtpUrlEntity entity) throws JSchException {
IdEntity idEntity = entity.idEntity;
if (idEntity.knowHost != null) {
File knowFile = new File(idEntity.knowHost);