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

📄 advancedsettings.java

📁 java ftp 鞭策帮手 可一啊啊觉得上
💻 JAVA
字号:
/**
 * 
 *  Copyright (C) 2007 Enterprise Distributed Technologies Ltd
 *
 *  www.enterprisedt.com
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  Bug fixes, suggestions and comments should be should posted on 
 *  http://www.enterprisedt.com/forums/index.php
 *
 *  Change Log:
 *
 *    $Log: AdvancedSettings.java,v $
 *    Revision 1.2  2007-12-20 00:40:16  bruceb
 *    autologin
 *
 *    Revision 1.1  2007-12-18 07:52:06  bruceb
 *    2.0 changes
 *
 *
 */
package com.enterprisedt.net.ftp;


/**
 *  Holds advanced configuration options not likely to be used for
 *  basic FTP operations. These options must be set prior to establishing
 *  connections, otherwise they have no effect until a new connection is made.
 *
 *  @author      Bruce Blackshaw
 *  @version     $Revision: 1.2 $
 */
public class AdvancedSettings {

    protected ConnectionContext context;
    
    /**
     * Determine if auto login is switched on
     * 
     * @return true if auto login
     */
    public boolean isAutoLogin() {
        return context.isAutoLogin();
    }

    /**
     * Set the autoLogin flag
     * 
     * @param autoLogin   true if logging in automatically
     */
    public void setAutoLogin(boolean autoLogin) {
        context.setAutoLogin(autoLogin);
    }
    
    /**
     * Constructor
     * 
     * @param context  context that settings are kept in
     */
    protected AdvancedSettings(ConnectionContext context) {
        this.context = context;
    }
    
    /**
     * Listen on all interfaces for active mode transfers (the default).
     * 
     * @param listenOnAll   true if listen on all interfaces, false to listen on the control interface
     */
    public void setListenOnAllInterfaces(boolean listenOnAll) {
        context.setListenOnAllInterfaces(listenOnAll);
    }
    
    /**
     * Are we listening on all interfaces in active mode, which is the default?
     * 
     * @return true if listening on all interfaces, false if listening just on the control interface
     */
    public boolean getListenOnAllInterfaces() {
        return context.getListenOnAllInterfaces();
    }
    
    /**
     * If true, delete partially written files when exceptions are thrown
     * during a download
     * 
     * @return true if delete local file on error
     */
    public boolean isDeleteOnFailure() {
        return context.isDeleteOnFailure();
    }

    /**
     * Switch on or off the automatic deletion of partially written files 
     * that are left when an exception is thrown during a download
     * 
     * @param deleteOnFailure  true if delete when a failure occurs
     */
    public void setDeleteOnFailure(boolean deleteOnFailure) {
        context.setDeleteOnFailure(deleteOnFailure);
    }
    
    /**
     * Get the encoding used for the control channel
     * 
     * @return Returns the current controlEncoding.
     */
    public String getControlEncoding() {
        return context.getControlEncoding();
    }
    
    /**
     * Set the control channel encoding. 
     * 
     * @param controlEncoding The controlEncoding to set, which is the name of a Charset
     */
    public void setControlEncoding(String controlEncoding) {
        context.setControlEncoding(controlEncoding);
    }
    
    /**
     * Set the size of the data buffers used in reading and writing to the server
     * 
     * @param size  new size of buffer in bytes
     */
    public void setTransferBufferSize(int size) {
        context.setTransferBufferSize(size);
    }
    
    /**
     * Get the size of the data buffers used in reading and writing to the server
     * 
     * @return  transfer buffer size
     */
    public int getTransferBufferSize() {
        return context.getTransferBufferSize();
    }
    
    /**
     * Get the interval used for progress notification of transfers.
     * 
     * @return number of bytes between each notification.
     */
    public int getTransferNotifyInterval() {
        return context.getTransferNotifyInterval();
    }

    /**
     * Set the interval used for progress notification of transfers.
     * 
     * @param notifyInterval  number of bytes between each notification
     */
    public void setTransferNotifyInterval(int notifyInterval) {
        context.setTransferNotifyInterval(notifyInterval);
    }

}

⌨️ 快捷键说明

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