⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sftptransfer.java

📁 一个JAVA做的FTP软件,带源码的,可以很好的进行二次开发,,并带有详细说明文件的
💻 JAVA
字号:
package net.sf.jftp.net;import net.sf.jftp.config.*;import net.sf.jftp.util.*;import java.io.*;import java.util.*;public class SftpTransfer implements Runnable{    private String host;    private String localPath;    private String remotePath;    private String file;    private String user;    private String pass;    private SftpConnection con = null;    private String type;    public Thread runner;    private Vector listeners;    public SftpTransfer(String host, String localPath, String remotePath,                        String file, String user, String pass,                        Vector listeners, String type)    {        this.host = host;        this.localPath = localPath;        this.remotePath = remotePath;        this.file = file;        this.user = user;        this.pass = pass;        this.type = type;        this.listeners = listeners;        prepare();    }    public void prepare()    {        runner = new Thread(this);        runner.setPriority(Thread.MIN_PRIORITY);        runner.start();    }    public void run()    {        con = new SftpConnection(host);        con.setConnectionListeners(listeners);        con.login(user, pass);        con.setLocalPath(localPath);        con.chdir(remotePath);        if(type.equals(Transfer.DOWNLOAD))        {            con.download(file);        }        else if(type.equals(Transfer.UPLOAD))        {            con.upload(file);        }    }    public SftpConnection getSftpConnection()    {        return con;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -