java.lang.Object
org.miaixz.bus.extra.ftp.FtpConfig
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionConstructs a new, emptyFtpConfiginstance.Constructs a newFtpConfiginstance with specified connection information and character set.Constructs a newFtpConfiginstance with specified connection information, character set, server language code, and system key. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the character set used for FTP operations.Retrieves the connection information for the FTP server.Retrieves the server language code.longRetrieves the socket read timeout duration in milliseconds.Retrieves the server system keyword.static FtpConfigof()Creates a defaultFtpConfiginstance with no parameters set.setCharset(Charset charset) Sets the character set for FTP operations.setConnectionTimeout(long timeout) Sets the connection timeout duration for the FTP connection.setConnector(Connector connector) Sets the connection information for the FTP server.setServerLanguageCode(String serverLanguageCode) Sets the server language code.setSoTimeout(long soTimeout) Sets the socket read timeout duration in milliseconds.setSystemKey(String systemKey) Sets the server system keyword.
-
Constructor Details
-
FtpConfig
public FtpConfig()Constructs a new, emptyFtpConfiginstance. All fields are initialized to their default values (null or 0). -
FtpConfig
Constructs a newFtpConfiginstance with specified connection information and character set. -
FtpConfig
Constructs a newFtpConfiginstance with specified connection information, character set, server language code, and system key.
-
-
Method Details
-
of
Creates a defaultFtpConfiginstance with no parameters set. This is a static factory method for convenient object creation.- Returns:
- A new
FtpConfiginstance.
-
getConnector
Retrieves the connection information for the FTP server.- Returns:
- The
Connectorobject containing host, port, user, password, etc.
-
setConnector
Sets the connection information for the FTP server.- Parameters:
connector- TheConnectorobject to set.- Returns:
- This
FtpConfiginstance, allowing for method chaining.
-
setConnectionTimeout
Sets the connection timeout duration for the FTP connection. If theConnectorobject is null, a new one will be created.- Parameters:
timeout- The connection timeout duration in milliseconds.- Returns:
- This
FtpConfiginstance, allowing for method chaining.
-
getCharset
Retrieves the character set used for FTP operations.- Returns:
- The
Charsetused for encoding and decoding.
-
setCharset
Sets the character set for FTP operations.- Parameters:
charset- TheCharsetto set.- Returns:
- This
FtpConfiginstance, 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
Sets the socket read timeout duration in milliseconds.- Parameters:
soTimeout- The socket read timeout duration to set.- Returns:
- This
FtpConfiginstance, allowing for method chaining.
-
getServerLanguageCode
Retrieves the server language code.- Returns:
- The server language code as a
String.
-
setServerLanguageCode
Sets the server language code.- Parameters:
serverLanguageCode- The server language code to set.- Returns:
- This
FtpConfiginstance, allowing for method chaining.
-
getSystemKey
Retrieves the server system keyword.- Returns:
- The server system keyword as a
String.
-
setSystemKey
Sets the server system keyword.- Parameters:
systemKey- The server system keyword to set.- Returns:
- This
FtpConfiginstance, allowing for method chaining.
-