Class FtpClient

java.lang.Object
ecmwf.common.ftp.FtpClient

public final class FtpClient extends Object
The Class FtpClient.
  • Field Details

  • Constructor Details

    • FtpClient

      public FtpClient()
      Instantiates a new ftp client.
  • Method Details

    • connect

      public void connect(String host) throws IOException
      Connect.
      Parameters:
      host - the host
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • connect

      public void connect(String host, int port) throws IOException
      Connect.
      Parameters:
      host - the host
      port - the port
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • retryLogin

      public void retryLogin() throws IOException
      Retry login.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • toString

      public String toString()
      To string.
      Overrides:
      toString in class Object
    • setClientSocketStatistics

      public void setClientSocketStatistics(ClientSocketStatistics statistics)
      Set a client socket statistics to gather socket statistics (ss output).
      Parameters:
      statistics - the client socket statistics
    • setTCPCongestion

      public void setTCPCongestion(String tcpCongestion)
      Set a TCP option.
      Parameters:
      tcpCongestion - the TCP congestion algorithm name
    • setSOMaxPacingRate

      public void setSOMaxPacingRate(ByteSize soMaxPacingRate)
      Set a SO option.
      Parameters:
      soMaxPacingRate - set the maximum transmit rate in bytes per second for the socket.
    • setTCPMaxSegment

      public void setTCPMaxSegment(Integer tcpMaxSegment)
      Set a TCP option.
      Parameters:
      tcpMaxSegment - maximum amount of data that can be sent in a single TCP segment.
    • setTCPTimeStamp

      public void setTCPTimeStamp(Boolean tcpTimeStamp)
      Set a TCP option.
      Parameters:
      tcpTimeStamp - enables or disables the use of timestamps in TCP packets
    • setTCPWindowClamp

      public void setTCPWindowClamp(Integer tcpWindowClamp)
      Set a TCP option.
      Parameters:
      tcpWindowClamp - bound the size of the advertised window to this value
    • setTCPKeepAliveTime

      public void setTCPKeepAliveTime(Integer tcpKeepAliveTime)
      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

      public void setTCPKeepAliveInterval(Integer tcpKeepAliveInterval)
      Set a TCP option.
      Parameters:
      tcpKeepAliveInterval - the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
    • setTCPKeepAliveProbes

      public void setTCPKeepAliveProbes(Integer tcpKeepAliveProbes)
      Set a TCP option.
      Parameters:
      tcpKeepAliveProbes - the number of unacknowledged probes to send before considering the connection dead and notifying the application layer
    • setTCPLinger

      public void setTCPLinger(Boolean tcpLingerEnable, Integer tcpLingerTime)
      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 enable
      tcpLingerTime - the amount of time, in seconds, the socket should linger before closing
    • setTCPUserTimeout

      public void setTCPUserTimeout(Integer tcpUserTimeout)
      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

      public void setTCPQuickAck(Boolean tcpQuickAck)
      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

      public void setTCPNoDelay(Boolean tcpNoDelay)
      Controls whether the TCP no delay option should be set.
      Parameters:
      tcpNoDelay - tcp no delay.
    • setTCPKeepAlive

      public void setTCPKeepAlive(Boolean tcpKeepAlive)
      Controls whether the TCP keep alive option should be set.
      Parameters:
      tcpKeepAlive - the new TCP keep alive
    • getHost

      public String getHost()
      Gets the host.
      Returns:
      the host
    • setCommTimeOut

      public void setCommTimeOut(int commTimeOut)
      Sets the comm time out.
      Parameters:
      commTimeOut - the new comm time out
    • setListenAddress

      public void setListenAddress(String listenAddress)
      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
    • setSharedPassive

      public void setSharedPassive(boolean sharedPassive)
      Sets the shared passive.
      Parameters:
      sharedPassive - the new shared passive
    • 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

      public void setNoop(String noop)
      Sets the noop.
      Parameters:
      noop - the new noop
    • setDebug

      public void setDebug(boolean debug)
      Sets the debug.
      Parameters:
      debug - the new debug
    • setInputFilters

      public void setInputFilters(String filters) throws IOException
      Sets the input filters.
      Parameters:
      filters - the new input filters
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • setOutputFilters

      public void setOutputFilters(String filters) throws IOException
      Sets the output filters.
      Parameters:
      filters - the new output filters
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • delegateChecksum

      public void delegateChecksum() throws IOException
      Delegate checksum.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • dumpChecksum

      public void dumpChecksum(String checksum, String fileName) throws IOException
      Dump checksum.
      Parameters:
      checksum - the checksum
      fileName - 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

      public String getResponseString()
      Gets the response string.
      Returns:
      the response string
    • getResponseStringNoReset

      public String 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

      public void issueCommandCheck(String cmd) throws IOException
      Issue command check.
      Parameters:
      cmd - the cmd
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • issueCommandCheck

      public void issueCommandCheck(String cmd, boolean isError) throws IOException
      Issue command check.
      Parameters:
      cmd - the cmd
      isError - the is error
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • dissCommandCheck

      public String dissCommandCheck(String cmd) throws IOException
      Diss command check.
      Parameters:
      cmd - the cmd
      Returns:
      the string
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • login

      public void login(String user, String password) throws IOException
      Login.
      Parameters:
      user - the user
      password - the password
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • get

      public InputStream get(String filename, long posn, int streamsCount) throws IOException
      Gets the.
      Parameters:
      filename - the filename
      posn - the posn
      streamsCount - 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 filename
      posn - the posn
      size - the size
      append - the append
      streamsCount - the streams count
      Returns:
      the output stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • checkPendingReply

      public int checkPendingReply() throws IOException
      Check pending reply.
      Returns:
      the int
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • nlist

      public BufferedReader nlist(String remoteDirectory) throws IOException
      Nlist.
      Parameters:
      remoteDirectory - the remote directory
      Returns:
      the buffered reader
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • list

      public BufferedReader list(String remoteDirectory) throws IOException
      List.
      Parameters:
      remoteDirectory - the remote directory
      Returns:
      the buffered reader
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • cd

      public void cd(String remoteDirectory) throws IOException
      Cd.
      Parameters:
      remoteDirectory - the remote directory
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • rename

      public void rename(String oldFile, String newFile) throws IOException
      Rename.
      Parameters:
      oldFile - the old file
      newFile - the new file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • site

      public void site(String params) throws IOException
      Site.
      Parameters:
      params - the params
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • binary

      public void binary() throws IOException
      Binary.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • ascii

      public void ascii() throws IOException
      Ascii.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • abort

      public void abort() throws IOException
      Abort.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • cdup

      public void cdup() throws IOException
      Cdup.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • mkdir

      public void mkdir(String s) throws IOException
      Mkdir.
      Parameters:
      s - the s
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • rmdir

      public void rmdir(String s) throws IOException
      Rmdir.
      Parameters:
      s - the s
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • delete

      public void delete(String s) throws IOException
      Delete.
      Parameters:
      s - the s
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • pwd

      public void pwd() throws IOException
      Pwd.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • syst

      public void syst() throws IOException
      Syst.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • noop

      public void noop() throws IOException
      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

      public void size(String s) throws IOException
      Size.
      Parameters:
      s - the s
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • mdtm

      public void mdtm(String s) throws IOException
      Mdtm.
      Parameters:
      s - the s
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • empty

      public void empty(String s) throws IOException
      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