Module bus.extra

Class FtpConfig

java.lang.Object
org.miaixz.bus.extra.ftp.FtpConfig
All Implemented Interfaces:
Serializable

public class FtpConfig extends Object implements Serializable
Configuration class for FTP (File Transfer Protocol) operations. This class encapsulates various parameters required to establish and manage an FTP connection, including connection details, character encoding, timeouts, and server-specific settings.
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Details

    • FtpConfig

      public FtpConfig()
      Constructs a new, empty FtpConfig instance. All fields are initialized to their default values (null or 0).
    • FtpConfig

      public FtpConfig(Connector connector, Charset charset)
      Constructs a new FtpConfig instance with specified connection information and character set.
      Parameters:
      connector - The Connector object containing host, port, user, password, etc.
      charset - The Charset to use for encoding and decoding.
    • FtpConfig

      public FtpConfig(Connector connector, Charset charset, String serverLanguageCode, String systemKey)
      Constructs a new FtpConfig instance with specified connection information, character set, server language code, and system key.
      Parameters:
      connector - The Connector object containing host, port, user, password, etc.
      charset - The Charset to use for encoding and decoding.
      serverLanguageCode - The server language code, e.g., "en", "zh".
      systemKey - The server system keyword, e.g., "UNIX", "WINDOWS".
  • Method Details

    • of

      public static FtpConfig of()
      Creates a default FtpConfig instance with no parameters set. This is a static factory method for convenient object creation.
      Returns:
      A new FtpConfig instance.
    • getConnector

      public Connector getConnector()
      Retrieves the connection information for the FTP server.
      Returns:
      The Connector object containing host, port, user, password, etc.
    • setConnector

      public FtpConfig setConnector(Connector connector)
      Sets the connection information for the FTP server.
      Parameters:
      connector - The Connector object to set.
      Returns:
      This FtpConfig instance, allowing for method chaining.
    • setConnectionTimeout

      public FtpConfig setConnectionTimeout(long timeout)
      Sets the connection timeout duration for the FTP connection. If the Connector object is null, a new one will be created.
      Parameters:
      timeout - The connection timeout duration in milliseconds.
      Returns:
      This FtpConfig instance, allowing for method chaining.
    • getCharset

      public Charset getCharset()
      Retrieves the character set used for FTP operations.
      Returns:
      The Charset used for encoding and decoding.
    • setCharset

      public FtpConfig setCharset(Charset charset)
      Sets the character set for FTP operations.
      Parameters:
      charset - The Charset to set.
      Returns:
      This FtpConfig instance, allowing for method chaining.
    • getSoTimeout

      public long getSoTimeout()
      Retrieves the socket read timeout duration in milliseconds. This specifies how long to wait for data to be read from the socket before timing out.
      Returns:
      The socket read timeout duration in milliseconds.
    • setSoTimeout

      public FtpConfig setSoTimeout(long soTimeout)
      Sets the socket read timeout duration in milliseconds.
      Parameters:
      soTimeout - The socket read timeout duration to set.
      Returns:
      This FtpConfig instance, allowing for method chaining.
    • getServerLanguageCode

      public String getServerLanguageCode()
      Retrieves the server language code.
      Returns:
      The server language code as a String.
    • setServerLanguageCode

      public FtpConfig setServerLanguageCode(String serverLanguageCode)
      Sets the server language code.
      Parameters:
      serverLanguageCode - The server language code to set.
      Returns:
      This FtpConfig instance, allowing for method chaining.
    • getSystemKey

      public String getSystemKey()
      Retrieves the server system keyword.
      Returns:
      The server system keyword as a String.
    • setSystemKey

      public FtpConfig setSystemKey(String systemKey)
      Sets the server system keyword.
      Parameters:
      systemKey - The server system keyword to set.
      Returns:
      This FtpConfig instance, allowing for method chaining.