Class FtpClient
java.lang.Object
ecmwf.common.ftp.FtpClient
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort.voidascii()Ascii.voidbinary()Binary.voidCd.voidcdup()Cdup.intCheck pending reply.voidclose(boolean gracefully) Close.booleanCommand is open.voidConnect.voidConnect.voidDelegate checksum.voidDelete.dissCommandCheck(String cmd) Diss command check.voiddumpChecksum(String checksum, String fileName) Dump checksum.voidEmpty.Gets the.getHost()Gets the host.Gets the response string.Gets the response string no reset.booleanisAlive()Checks if is alive.voidissueCommandCheck(String cmd) Issue command check.voidissueCommandCheck(String cmd, boolean isError) Issue command check.voidkeepControlConnectionAlive(boolean keepAlive) Keep control connection alive.List.voidLogin.voidMdtm.voidMkdir.Nlist.voidnoop()Noop.Puts the.voidpwd()Pwd.voidRename.voidRetry login.voidRmdir.voidsetClientSocketStatistics(ClientSocketStatistics statistics) Set a client socket statistics to gather socket statistics (ss output).voidsetCommTimeOut(int commTimeOut) Sets the comm time out.voidsetDataAlive(boolean dataAlive) Sets the data alive.voidsetDataTimeOut(int dataTimeOut) Sets the data time out.voidsetDebug(boolean debug) Sets the debug.voidsetExtended(boolean extended) Sets the extended.voidsetInputFilters(String filters) Sets the input filters.voidsetListenAddress(String listenAddress) Sets the listen address.voidsetLowPort(boolean lowPort) Sets the low port.voidsetMkdirs(boolean mkdirs) Sets the mkdirs.voidSets the noop.voidsetOutputFilters(String filters) Sets the output filters.voidsetPacket(boolean packet) Sets the packet.voidsetPassive(boolean passive) Sets the passive.voidsetPortTimeOut(int portTimeOut) Sets the port time out.voidsetReceiveBufferSize(int receiveBufferSize) Sets the receive buffer size.voidsetSendBufferSize(int sendBufferSize) Sets the sends the buffer size.voidsetSharedPassive(boolean sharedPassive) Sets the shared passive.voidsetSOMaxPacingRate(ByteSize soMaxPacingRate) Set a SO option.voidsetTCPCongestion(String tcpCongestion) Set a TCP option.voidsetTCPKeepAlive(Boolean tcpKeepAlive) Controls whether the TCP keep alive option should be set.voidsetTCPKeepAliveInterval(Integer tcpKeepAliveInterval) Set a TCP option.voidsetTCPKeepAliveProbes(Integer tcpKeepAliveProbes) Set a TCP option.voidsetTCPKeepAliveTime(Integer tcpKeepAliveTime) Set a TCP option.voidsetTCPLinger(Boolean tcpLingerEnable, Integer tcpLingerTime) Controls the behavior of a socket when it is closed and there is unsent data.voidsetTCPMaxSegment(Integer tcpMaxSegment) Set a TCP option.voidsetTCPNoDelay(Boolean tcpNoDelay) Controls whether the TCP no delay option should be set.voidsetTCPQuickAck(Boolean tcpQuickAck) Controls whether the TCP stack should quickly acknowledge incoming data.voidsetTCPTimeStamp(Boolean tcpTimeStamp) Set a TCP option.voidsetTCPUserTimeout(Integer tcpUserTimeout) Provides a way to control the timeout for unacknowledged data on a TCP connection.voidsetTCPWindowClamp(Integer tcpWindowClamp) Set a TCP option.voidSite.voidSize.voidsyst()Syst.toString()To string.
-
Field Details
-
FTP_PORT
public static final int FTP_PORTThe Constant FTP_PORT.- See Also:
-
-
Constructor Details
-
FtpClient
public FtpClient()Instantiates a new ftp client.
-
-
Method Details
-
connect
Connect.- Parameters:
host- the host- Throws:
IOException- Signals that an I/O exception has occurred.
-
connect
Connect.- Parameters:
host- the hostport- the port- Throws:
IOException- Signals that an I/O exception has occurred.
-
retryLogin
Retry login.- Throws:
IOException- Signals that an I/O exception has occurred.
-
toString
-
setClientSocketStatistics
Set a client socket statistics to gather socket statistics (ss output).- Parameters:
statistics- the client socket statistics
-
setTCPCongestion
Set a TCP option.- Parameters:
tcpCongestion- the TCP congestion algorithm name
-
setSOMaxPacingRate
Set a SO option.- Parameters:
soMaxPacingRate- set the maximum transmit rate in bytes per second for the socket.
-
setTCPMaxSegment
Set a TCP option.- Parameters:
tcpMaxSegment- maximum amount of data that can be sent in a single TCP segment.
-
setTCPTimeStamp
Set a TCP option.- Parameters:
tcpTimeStamp- enables or disables the use of timestamps in TCP packets
-
setTCPWindowClamp
Set a TCP option.- Parameters:
tcpWindowClamp- bound the size of the advertised window to this value
-
setTCPKeepAliveTime
Set a TCP option.- Parameters:
tcpKeepAliveTime- the interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further
-
setTCPKeepAliveInterval
Set a TCP option.- Parameters:
tcpKeepAliveInterval- the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
-
setTCPKeepAliveProbes
Set a TCP option.- Parameters:
tcpKeepAliveProbes- the number of unacknowledged probes to send before considering the connection dead and notifying the application layer
-
setTCPLinger
Controls the behavior of a socket when it is closed and there is unsent data. It specifies whether the socket should linger for a specified amount of time before closing. The TCP_LINGER option is often used to ensure that all data is sent before the socket is closed.- Parameters:
tcpLingerEnable- the tcp linger enabletcpLingerTime- the amount of time, in seconds, the socket should linger before closing
-
setTCPUserTimeout
Provides a way to control the timeout for unacknowledged data on a TCP connection.- Parameters:
tcpUserTimeout- maximum amount of time, in milliseconds, that transmitted data may remain unacknowledged before an error is returned
-
setTCPQuickAck
Controls whether the TCP stack should quickly acknowledge incoming data.- Parameters:
tcpQuickAck- when enabled, the TCP stack sends immediate acknowledgment for incoming data without waiting for the delayed acknowledgment timer.
-
setTCPNoDelay
Controls whether the TCP no delay option should be set.- Parameters:
tcpNoDelay- tcp no delay.
-
setTCPKeepAlive
Controls whether the TCP keep alive option should be set.- Parameters:
tcpKeepAlive- the new TCP keep alive
-
getHost
-
setCommTimeOut
public void setCommTimeOut(int commTimeOut) Sets the comm time out.- Parameters:
commTimeOut- the new comm time out
-
setListenAddress
Sets the listen address.- Parameters:
listenAddress- the new listen address
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize) Sets the sends the buffer size.- Parameters:
sendBufferSize- the new sends the buffer size
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize) Sets the receive buffer size.- Parameters:
receiveBufferSize- the new receive buffer size
-
setMkdirs
public void setMkdirs(boolean mkdirs) Sets the mkdirs.- Parameters:
mkdirs- the new mkdirs
-
setDataTimeOut
public void setDataTimeOut(int dataTimeOut) Sets the data time out.- Parameters:
dataTimeOut- the new data time out
-
setPortTimeOut
public void setPortTimeOut(int portTimeOut) Sets the port time out.- Parameters:
portTimeOut- the new port time out
-
setPassive
public void setPassive(boolean passive) Sets the passive.- Parameters:
passive- the new passive
-
setExtended
public void setExtended(boolean extended) Sets the extended.- Parameters:
extended- the new extended
-
setPacket
public void setPacket(boolean packet) Sets the packet.- Parameters:
packet- the new packet
-
setDataAlive
public void setDataAlive(boolean dataAlive) Sets the data alive.- Parameters:
dataAlive- the new data alive
-
setLowPort
public void setLowPort(boolean lowPort) Sets the low port.- Parameters:
lowPort- the new low port
-
setNoop
-
setDebug
public void setDebug(boolean debug) Sets the debug.- Parameters:
debug- the new debug
-
setInputFilters
Sets the input filters.- Parameters:
filters- the new input filters- Throws:
IOException- Signals that an I/O exception has occurred.
-
setOutputFilters
Sets the output filters.- Parameters:
filters- the new output filters- Throws:
IOException- Signals that an I/O exception has occurred.
-
delegateChecksum
Delegate checksum.- Throws:
IOException- Signals that an I/O exception has occurred.
-
dumpChecksum
Dump checksum.- Parameters:
checksum- the checksumfileName- the file name- Throws:
IOException- Signals that an I/O exception has occurred.
-
commandIsOpen
public boolean commandIsOpen()Command is open.- Returns:
- true, if successful
-
getResponseString
-
getResponseStringNoReset
Gets the response string no reset.- Returns:
- the response string no reset
-
close
public void close(boolean gracefully) Close.- Parameters:
gracefully- the gracefully
-
issueCommandCheck
Issue command check.- Parameters:
cmd- the cmd- Throws:
IOException- Signals that an I/O exception has occurred.
-
issueCommandCheck
Issue command check.- Parameters:
cmd- the cmdisError- the is error- Throws:
IOException- Signals that an I/O exception has occurred.
-
dissCommandCheck
Diss command check.- Parameters:
cmd- the cmd- Returns:
- the string
- Throws:
IOException- Signals that an I/O exception has occurred.
-
login
Login.- Parameters:
user- the userpassword- the password- Throws:
IOException- Signals that an I/O exception has occurred.
-
get
Gets the.- Parameters:
filename- the filenameposn- the posnstreamsCount- the streams count- Returns:
- the input stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
put
public OutputStream put(String filename, long posn, long size, boolean append, int streamsCount) throws IOException Puts the.- Parameters:
filename- the filenameposn- the posnsize- the sizeappend- the appendstreamsCount- the streams count- Returns:
- the output stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
checkPendingReply
Check pending reply.- Returns:
- the int
- Throws:
IOException- Signals that an I/O exception has occurred.
-
nlist
Nlist.- Parameters:
remoteDirectory- the remote directory- Returns:
- the buffered reader
- Throws:
IOException- Signals that an I/O exception has occurred.
-
list
List.- Parameters:
remoteDirectory- the remote directory- Returns:
- the buffered reader
- Throws:
IOException- Signals that an I/O exception has occurred.
-
cd
Cd.- Parameters:
remoteDirectory- the remote directory- Throws:
IOException- Signals that an I/O exception has occurred.
-
rename
Rename.- Parameters:
oldFile- the old filenewFile- the new file- Throws:
IOException- Signals that an I/O exception has occurred.
-
site
Site.- Parameters:
params- the params- Throws:
IOException- Signals that an I/O exception has occurred.
-
binary
Binary.- Throws:
IOException- Signals that an I/O exception has occurred.
-
ascii
Ascii.- Throws:
IOException- Signals that an I/O exception has occurred.
-
abort
Abort.- Throws:
IOException- Signals that an I/O exception has occurred.
-
cdup
Cdup.- Throws:
IOException- Signals that an I/O exception has occurred.
-
mkdir
Mkdir.- Parameters:
s- the s- Throws:
IOException- Signals that an I/O exception has occurred.
-
rmdir
Rmdir.- Parameters:
s- the s- Throws:
IOException- Signals that an I/O exception has occurred.
-
delete
Delete.- Parameters:
s- the s- Throws:
IOException- Signals that an I/O exception has occurred.
-
pwd
Pwd.- Throws:
IOException- Signals that an I/O exception has occurred.
-
syst
Syst.- Throws:
IOException- Signals that an I/O exception has occurred.
-
noop
Noop.- Throws:
IOException- Signals that an I/O exception has occurred.
-
isAlive
public boolean isAlive()Checks if is alive.- Returns:
- true, if is alive
-
size
Size.- Parameters:
s- the s- Throws:
IOException- Signals that an I/O exception has occurred.
-
mdtm
Mdtm.- Parameters:
s- the s- Throws:
IOException- Signals that an I/O exception has occurred.
-
empty
Empty.- Parameters:
s- the s- Throws:
IOException- Signals that an I/O exception has occurred.
-
keepControlConnectionAlive
public void keepControlConnectionAlive(boolean keepAlive) Keep control connection alive.- Parameters:
keepAlive- the keep alive
-