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

📄 ftp.java

📁 JavaExplorer是一个独立于平台的浏览器
💻 JAVA
字号:
/**  * File and FTP Explorer  * Copyright 2002  * BOESCH Vincent  *  * This program is free software; you can redistribute it and/or  * modify it under the terms of the GNU General Public License  * as published by the Free Software Foundation; either version 2  * of the License, or (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  * GNU General Public License for more details.  *  * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  */package javaexplorer.util.ftp;import objectxml.XMLContent;import objectxml.Xmlizable;import java.io.Serializable;import javaexplorer.util.ExplorerUtil;public class Ftp implements Serializable, Xmlizable {    private String _host;    private String _password;    private int _port;    private boolean _showInDiskList = false;    private String _title;    private boolean _usePassiveMode = false;    private String _user;    private String _group;    /**     *  Constructeur objet Ftp     */    public Ftp() {    }    /**     *@param  ftp  Description of the Parameter     *@return      Description of the Return     *      Value     */    public boolean equals(Ftp ftp) {        if (ftp == null) {            return false;        }        return _host.equalsIgnoreCase(ftp._host) && (_port == ftp._port) &&        _user.equals(ftp._user) && _password.equals(ftp._password);    }    /**     *  Gets the host attribute of the Ftp     *  object     *     *@return    The host value     */    public String getHost() {        return _host;    }    /**     *  Gets the password attribute of the     *  Ftp object     *     *@return    The password value     */    public String getPassword() {        return _password;    }    /**     *  Gets the port attribute of the Ftp     *  object     *     *@return    The port value     */    public int getPort() {        return _port;    }    /**     *  Gets the showInDiskList attribute of     *  the Ftp object     *     *@return    The showInDiskList value     */    public boolean getShowInDiskList() {        return _showInDiskList;    }    /**     *  Gets the title attribute of the Ftp     *  object     *     *@return    The title value     */    public String getTitle() {        return _title;    }    /**     *  Gets the usePassiveMode attribute of     *  the Ftp object     *     *@return    The usePassiveMode value     */    public boolean getUsePassiveMode() {        return _usePassiveMode;    }    /**     *  Gets the user attribute of the Ftp     *  object     *     *@return    The user value     */    public String getUser() {        return _user;    }    /**     *  Gets the group attribute of the Ftp     *  object     *     *@return    The user value     */    public String getGroup() {        return _group;    }    /**     *  Sets the group attribute of the Ftp     *  object     *     *@return    The user value     */    public void setGroup(String group) {        _group = group;    }    /**     *  Sets the host attribute of the Ftp     *  object     *     *@param  host  The new host value     */    public void setHost(String host) {        _host = host;    }    /**     *  Sets the password attribute of the     *  Ftp object     *     *@param  password  The new password value     */    public void setPassword(String password) {        _password = password;    }    /**     *  Sets the port attribute of the Ftp     *  object     *     *@param  port  The new port value     */    public void setPort(int port) {        _port = port;    }    /**     *  Sets the showInDiskList attribute of     *  the Ftp object     *     *@param  showInDiskList  The new showInDiskList     *      value     */    public void setShowInDiskList(boolean showInDiskList) {        _showInDiskList = showInDiskList;    }    /**     *  Sets the title attribute of the Ftp     *  object     *     *@param  title  The new title value     */    public void setTitle(String title) {        _title = title;    }    /**     *  Sets the usePassiveMode attribute of     *  the Ftp object     *     *@param  usePassiveMode  The new usePassiveMode     *      value     */    public void setUsePassiveMode(boolean usePassiveMode) {        _usePassiveMode = usePassiveMode;    }    /**     *  Sets the user attribute of the Ftp     *  object     *     *@param  user  The new user value     */    public void setUser(String user) {        _user = user;    }    /**     *  Retourne les informations permettant     *  de classer les infos du FTP     *     *@return    Description of the Return     *      Value     */    public String toHash() {        return _host + "**" + _port + "**" + _user;    }    /**     *@return    Description of the Return     *      Value     */    public String toString() {        return _title + " (" + _host + ":" + _port + ")";    }    public XMLContent writeXMLProperties() {        XMLContent root = new XMLContent("ClassName", getClass().getName());        //Pas de param鑤res constructeurs        //Propri閠閟        XMLContent content = new XMLContent("Properties");        content.add(new XMLContent("Title", this.getTitle()));        content.add(new XMLContent("Host", this.getHost()));        content.add(new XMLContent("Port", "" + this.getPort()));        content.add(new XMLContent("User", this.getUser()));        content.add(new XMLContent("Group", this.getGroup()));        content.add(new XMLContent("Password",                ExplorerUtil.encrypt(this.getPassword())));        content.add(new XMLContent("PassiveMode", "" +                this.getUsePassiveMode()));        content.add(new XMLContent("DiskList", "" + this.getShowInDiskList()));        root.add(content);        return root;    }    public void readXMLProperties(XMLContent content) {        if (content == null) {            return;        }        XMLContent prop = null;        prop = content.getChild("Title");        if (prop != null) {            this.setTitle(prop.getValue());        }        prop = content.getChild("Host");        if (prop != null) {            this.setHost(prop.getValue());        }        prop = content.getChild("Port");        if (prop != null) {            this.setPort(Integer.parseInt(prop.getValue()));        }        prop = content.getChild("User");        if (prop != null) {            this.setUser(prop.getValue());        }        prop = content.getChild("Group");        if (prop != null) {            this.setGroup(prop.getValue());        }        prop = content.getChild("Password");        if (prop != null) {            this.setPassword(ExplorerUtil.decrypt(prop.getValue()));        }        prop = content.getChild("PassiveMode");        if (prop != null) {            this.setUsePassiveMode(Boolean.valueOf(prop.getValue())                                          .booleanValue());        }        prop = content.getChild("DiskList");        if (prop != null) {            this.setShowInDiskList(Boolean.valueOf(prop.getValue())                                          .booleanValue());        }    }}

⌨️ 快捷键说明

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