Class FtpClient
java.lang.Object
ecmwf.common.ftp.FtpClient
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Abort.void
ascii()
Ascii.void
binary()
Binary.void
Cd.void
cdup()
Cdup.int
Check pending reply.void
close
(boolean gracefully) Close.boolean
Command is open.void
Connect.void
Connect.void
Delegate checksum.void
Delete.dissCommandCheck
(String cmd) Diss command check.void
dumpChecksum
(String checksum, String fileName) Dump checksum.void
Empty.Gets the.getHost()
Gets the host.Gets the response string.Gets the response string no reset.boolean
isAlive()
Checks if is alive.void
issueCommandCheck
(String cmd) Issue command check.void
issueCommandCheck
(String cmd, boolean isError) Issue command check.void
keepControlConnectionAlive
(boolean keepAlive) Keep control connection alive.List.void
Login.void
Mdtm.void
Mkdir.Nlist.void
noop()
Noop.Puts the.void
pwd()
Pwd.void
Rename.void
Retry login.void
Rmdir.void
setClientSocketStatistics
(ClientSocketStatistics statistics) Set a client socket statistics to gather socket statistics (ss output).void
setCommTimeOut
(int commTimeOut) Sets the comm time out.void
setDataAlive
(boolean dataAlive) Sets the data alive.void
setDataTimeOut
(int dataTimeOut) Sets the data time out.void
setDebug
(boolean debug) Sets the debug.void
setExtended
(boolean extended) Sets the extended.void
setInputFilters
(String filters) Sets the input filters.void
setListenAddress
(String listenAddress) Sets the listen address.void
setLowPort
(boolean lowPort) Sets the low port.void
setMkdirs
(boolean mkdirs) Sets the mkdirs.void
Sets the noop.void
setOutputFilters
(String filters) Sets the output filters.void
setPacket
(boolean packet) Sets the packet.void
setPassive
(boolean passive) Sets the passive.void
setPortTimeOut
(int portTimeOut) Sets the port time out.void
setReceiveBufferSize
(int receiveBufferSize) Sets the receive buffer size.void
setSendBufferSize
(int sendBufferSize) Sets the sends the buffer size.void
setSharedPassive
(boolean sharedPassive) Sets the shared passive.void
setSOMaxPacingRate
(ByteSize soMaxPacingRate) Set a SO option.void
setTCPCongestion
(String tcpCongestion) Set a TCP option.void
setTCPKeepAlive
(Boolean tcpKeepAlive) Controls whether the TCP keep alive option should be set.void
setTCPKeepAliveInterval
(Integer tcpKeepAliveInterval) Set a TCP option.void
setTCPKeepAliveProbes
(Integer tcpKeepAliveProbes) Set a TCP option.void
setTCPKeepAliveTime
(Integer tcpKeepAliveTime) Set a TCP option.void
setTCPLinger
(Boolean tcpLingerEnable, Integer tcpLingerTime) Controls the behavior of a socket when it is closed and there is unsent data.void
setTCPMaxSegment
(Integer tcpMaxSegment) Set a TCP option.void
setTCPNoDelay
(Boolean tcpNoDelay) Controls whether the TCP no delay option should be set.void
setTCPQuickAck
(Boolean tcpQuickAck) Controls whether the TCP stack should quickly acknowledge incoming data.void
setTCPTimeStamp
(Boolean tcpTimeStamp) Set a TCP option.void
setTCPUserTimeout
(Integer tcpUserTimeout) Provides a way to control the timeout for unacknowledged data on a TCP connection.void
setTCPWindowClamp
(Integer tcpWindowClamp) Set a TCP option.void
Site.void
Size.void
syst()
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
-