public class FTPEnvironment extends Object implements Map<String,Object>, Cloneable
FileSystemProvider.newFileSystem(URI, Map) and
FileSystemProvider.newFileSystem(Path, Map) methods of FTPFileSystemProvider.| Constructor and Description |
|---|
FTPEnvironment()
Creates a new FTP environment.
|
FTPEnvironment(Map<String,Object> map)
Creates a new FTP environment.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
FTPEnvironment |
clone() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,Object>> |
entrySet() |
boolean |
equals(Object o) |
Object |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<String> |
keySet() |
Object |
put(String key,
Object value) |
void |
putAll(Map<? extends String,? extends Object> m) |
Object |
remove(Object key) |
int |
size() |
String |
toString() |
Collection<Object> |
values() |
FTPEnvironment |
withAbsoluteFilePathSupport(boolean supportAbsoluteFilePaths)
Deprecated.
Use
withFTPFileStrategyFactory(FTPFileStrategyFactory) instead. A value of true should be replaced with
FTPFileStrategyFactory.AUTO_DETECT, a value of false with FTPFileStrategyFactory.NON_UNIX. |
FTPEnvironment |
withActiveExternalIPAddress(String ipAddress)
Stores the external IP address in active mode.
|
FTPEnvironment |
withActivePortRange(int minPort,
int maxPort)
Stores the client side port range in active mode.
|
FTPEnvironment |
withActualTotalSpaceCalculation(boolean calculateActualTotalSpace)
Deprecated.
FileStore.getTotalSpace() does not need to traverse the file system, because that would calculate the total used
space, not the total space. |
FTPEnvironment |
withAutodetectEncoding(boolean autodetect)
Stores whether or not automatic server encoding detection should be enabled.
|
FTPEnvironment |
withBufferSize(int bufferSize)
Stores the buffer size to use.
|
FTPEnvironment |
withCharset(Charset charset)
Stores the charset to use.
|
FTPEnvironment |
withClientConfig(FTPClientConfig clientConfig)
Stores the FTP client config to use.
|
FTPEnvironment |
withClientConnectionCount(int count)
Stores the number of client connections to use.
|
FTPEnvironment |
withClientConnectionWaitTimeout(long timeout)
Stores the wait timeout to use for retrieving client connection from the connection pool.
|
FTPEnvironment |
withClientConnectionWaitTimeout(long duration,
TimeUnit unit)
Stores the wait timeout to use for retrieving client connections from the connection pool.
|
FTPEnvironment |
withConnectionMode(ConnectionMode connectionMode)
Stores the connection mode to use.
|
FTPEnvironment |
withConnectTimeout(int timeout)
Stores the connection timeout to use.
|
FTPEnvironment |
withControlEncoding(String encoding)
Stores the character encoding to be used by the FTP control connection.
|
FTPEnvironment |
withControlKeepAliveReplyTimeout(int timeout)
Stores how long to wait for control keep-alive message replies.
|
FTPEnvironment |
withControlKeepAliveTimeout(long timeout)
Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.
|
FTPEnvironment |
withCredentials(String username,
char[] password)
Stores the credentials to use.
|
FTPEnvironment |
withCredentials(String username,
char[] password,
String account)
Stores the credentials to use.
|
FTPEnvironment |
withDataTimeout(int timeout)
Stores the timeout in milliseconds to use when reading from data connections.
|
FTPEnvironment |
withDefaultDirectory(String pathname)
Stores the default directory to use.
|
FTPEnvironment |
withFileSystemExceptionFactory(FileSystemExceptionFactory factory)
Stores the file system exception factory to use.
|
FTPEnvironment |
withFTPFileStrategyFactory(FTPFileStrategyFactory factory)
Stores the FTP file strategy factory to use.
|
FTPEnvironment |
withKeepAlive(boolean keepAlive)
Stores whether or not
SO_KEEPALIVE should be enabled. |
FTPEnvironment |
withLocalAddress(InetAddress localAddr,
int localPort)
Stores the local address to use.
|
FTPEnvironment |
withParserFactory(FTPFileEntryParserFactory parserFactory)
Stores the factory used for parser creation.
|
FTPEnvironment |
withPassiveLocalIPAddress(String ipAddress)
Stores the local IP address to use in passive mode.
|
FTPEnvironment |
withPassiveNatWorkaround(boolean enabled)
Deprecated.
|
FTPEnvironment |
withPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver resolver)
Stores the workaround strategy to replace the PASV mode reply addresses.
|
FTPEnvironment |
withProxy(Proxy proxy)
Stores the proxy to use.
|
FTPEnvironment |
withReceiveBufferSize(int size)
Stores the socket receive buffer size to use.
|
FTPEnvironment |
withReceiveDataSocketBufferSize(int bufferSize)
Stores the value to use for the data socket
SO_RCVBUF option. |
FTPEnvironment |
withRemoteVerificationEnabled(boolean enabled)
Stores whether or not verification that the remote host taking part of a data connection is the same as the host to which the control
connection is attached should be enabled.
|
FTPEnvironment |
withReportActiveExternalIPAddress(String ipAddress)
Stores the external IP address to report in EPRT/PORT commands in active mode.
|
FTPEnvironment |
withSendBufferSize(int size)
Stores the socket send buffer size to use.
|
FTPEnvironment |
withSendDataSocketBufferSize(int bufferSizr)
Stores the value to use for the data socket
SO_SNDBUF option. |
FTPEnvironment |
withServerSocketFactory(ServerSocketFactory factory)
Stores the server socket factory to use.
|
FTPEnvironment |
withSocketFactory(SocketFactory factory)
Stores the socket factory to use.
|
FTPEnvironment |
withSoLinger(boolean on,
int linger)
Stores whether or not
SO_LINGER should be enabled, and if so, the linger time. |
FTPEnvironment |
withSoTimeout(int timeout)
Stores the socket timeout.
|
FTPEnvironment |
withStrictlyMultilineParsing(boolean strictMultilineParsing)
Stores whether or not strict multiline parsing should be enabled, as per RFC 959, section 4.2.
|
FTPEnvironment |
withTcpNoDelay(boolean on)
Stores whether or not the Nagle's algorithm (
TCP_NODELAY) should be enabled. |
FTPEnvironment |
withUseEPSVwithIPv4(boolean selected)
Stores whether or not to use EPSV with IPv4.
|
finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic FTPEnvironment withLocalAddress(InetAddress localAddr, int localPort)
localAddr - The local address to use.localPort - The local port to use.Socket.bind(SocketAddress),
InetSocketAddress.InetSocketAddress(InetAddress, int)public FTPEnvironment withCredentials(String username, char[] password)
username - The username to use.password - The password to use.public FTPEnvironment withCredentials(String username, char[] password, String account)
username - The username to use.password - The password to use.account - The account to use.public FTPEnvironment withSoTimeout(int timeout)
timeout - The socket timeout in milliseconds.Socket.setSoTimeout(int)public FTPEnvironment withSendBufferSize(int size)
size - The size of the buffer in bytes.Socket.setSendBufferSize(int)public FTPEnvironment withReceiveBufferSize(int size)
size - The size of the buffer in bytes.Socket.setReceiveBufferSize(int)public FTPEnvironment withTcpNoDelay(boolean on)
TCP_NODELAY) should be enabled.on - true if Nagle's algorithm should be enabled, or false otherwise.Socket.setTcpNoDelay(boolean)public FTPEnvironment withKeepAlive(boolean keepAlive)
SO_KEEPALIVE should be enabled.keepAlive - true if keep-alive should be enabled, or false otherwise.Socket.setKeepAlive(boolean)public FTPEnvironment withSoLinger(boolean on, int linger)
SO_LINGER should be enabled, and if so, the linger time.on - true if SO_LINGER should be enabled, or false otherwise.linger - The linger time in seconds, if on is true.Socket.setSoLinger(boolean, int)public FTPEnvironment withSocketFactory(SocketFactory factory)
factory - The socket factory to use.public FTPEnvironment withServerSocketFactory(ServerSocketFactory factory)
factory - The server socket factory to use.public FTPEnvironment withConnectTimeout(int timeout)
timeout - The connection timeout in milliseconds.Socket.connect(SocketAddress, int)public FTPEnvironment withProxy(Proxy proxy)
proxy - The proxy to use.public FTPEnvironment withCharset(Charset charset)
charset - The charset to use.public FTPEnvironment withControlEncoding(String encoding)
encoding - The character encoding to use.public FTPEnvironment withStrictlyMultilineParsing(boolean strictMultilineParsing)
strictMultilineParsing - true to enable strict multiline parsing, or false to disable it.public FTPEnvironment withDataTimeout(int timeout)
timeout - The timeout in milliseconds that is used when opening data connection sockets.public FTPEnvironment withParserFactory(FTPFileEntryParserFactory parserFactory)
parserFactory - The factory object used to create FTPFileEntryParserspublic FTPEnvironment withRemoteVerificationEnabled(boolean enabled)
enabled - true to enable verification, or false to disable verification.public FTPEnvironment withDefaultDirectory(String pathname)
pathname - The default directory to use.public FTPEnvironment withConnectionMode(ConnectionMode connectionMode)
ConnectionMode.ACTIVE.connectionMode - The connection mode to use.public FTPEnvironment withActivePortRange(int minPort, int maxPort)
minPort - The lowest available port (inclusive).maxPort - The highest available port (inclusive).public FTPEnvironment withActiveExternalIPAddress(String ipAddress)
ipAddress - The external IP address of this machine.public FTPEnvironment withPassiveLocalIPAddress(String ipAddress)
ipAddress - The local IP address of this machine.public FTPEnvironment withReportActiveExternalIPAddress(String ipAddress)
ipAddress - The external IP address of this machine.public FTPEnvironment withBufferSize(int bufferSize)
bufferSize - The buffer size to use.public FTPEnvironment withSendDataSocketBufferSize(int bufferSizr)
SO_SNDBUF option.bufferSizr - The size of the buffer.public FTPEnvironment withReceiveDataSocketBufferSize(int bufferSize)
SO_RCVBUF option.bufferSize - The size of the buffer.public FTPEnvironment withClientConfig(FTPClientConfig clientConfig)
clientConfig - The client config to use.public FTPEnvironment withUseEPSVwithIPv4(boolean selected)
For example, when using IPv4 with NAT it may work with some rare configurations. E.g. if FTP server has a static PASV address (external network) and the client is coming from another internal network. In that case the data connection after PASV command would fail, while EPSV would make the client succeed by taking just the port.
selected - The flag to use.public FTPEnvironment withControlKeepAliveTimeout(long timeout)
timeout - The keep-alive timeout to use, in milliseconds.public FTPEnvironment withControlKeepAliveReplyTimeout(int timeout)
timeout - The keep-alive reply timeout to use, in milliseconds.@Deprecated public FTPEnvironment withPassiveNatWorkaround(boolean enabled)
withPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver) instead.enabled - true to enable replacing internal IP's in passive mode, or false otherwise.public FTPEnvironment withPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver resolver)
FTPClient.NatServerResolverImpl, i.e. site-local replies are replaced.resolver - The workaround strategy to replace internal IP's in passive mode, or null to disable the workaround
(i.e. use PASV mode reply address.)public FTPEnvironment withAutodetectEncoding(boolean autodetect)
autodetect - true to enable automatic server encoding detection, or false to disable it.public FTPEnvironment withClientConnectionCount(int count)
count - The number of client connection to use.public FTPEnvironment withClientConnectionWaitTimeout(long timeout)
If the timeout is not larger than 0, the FTP file system waits indefinitely until a client connection becomes available.
timeout - The timeout in milliseconds.withClientConnectionWaitTimeout(long, TimeUnit)public FTPEnvironment withClientConnectionWaitTimeout(long duration, TimeUnit unit)
If the timeout is not larger than 0, the FTP file system waits indefinitely until a client connection becomes available.
duration - The timeout duration.unit - The timeout unit.NullPointerException - If the timeout unit is null.withClientConnectionWaitTimeout(long)public FTPEnvironment withFileSystemExceptionFactory(FileSystemExceptionFactory factory)
factory - The file system exception factory to use.public FTPEnvironment withFTPFileStrategyFactory(FTPFileStrategyFactory factory)
factory - The FTP file strategy factory to use.@Deprecated public FTPEnvironment withAbsoluteFilePathSupport(boolean supportAbsoluteFilePaths)
withFTPFileStrategyFactory(FTPFileStrategyFactory) instead. A value of true should be replaced with
FTPFileStrategyFactory.AUTO_DETECT, a value of false with FTPFileStrategyFactory.NON_UNIX.false, getting information about a file will list its
parent directory. If set to true, the server settings will determine how files are listed.
This setting should be set to false for servers that do not support LIST commands of absolute files.
supportAbsoluteFilePaths - false if FTP servers do not support absolute paths to list files,
or true to use the server settings.@Deprecated public FTPEnvironment withActualTotalSpaceCalculation(boolean calculateActualTotalSpace)
FileStore.getTotalSpace() does not need to traverse the file system, because that would calculate the total used
space, not the total space.FileStore.getTotalSpace() should calculate the actual total space by traversing the file system.
If not explicitly set to true, the method will return Long.MAX_VALUE instead.calculateActualTotalSpace - true if FileStore.getTotalSpace() should calculate the actual total space by traversing the
file system, or false otherwise.public boolean containsKey(Object key)
containsKey in interface Map<String,Object>public boolean containsValue(Object value)
containsValue in interface Map<String,Object>public boolean equals(Object o)
public int hashCode()
public FTPEnvironment clone()
Copyright © 2016–2019. All rights reserved.