Interface FtpChannel


  • public interface FtpChannel
    An interface providing FTP operations over a RemoteSession. All operations are supposed to throw FtpChannel.FtpException for remote file system errors and other IOExceptions on connection errors.
    Since:
    5.2
    • Method Detail

      • connect

        void connect​(int timeout,
                     TimeUnit unit)
              throws IOException
        Connects the FtpChannel to the remote end.
        Parameters:
        timeout - for establishing the FTP connection
        unit - of the timeout
        Throws:
        IOException
      • disconnect

        void disconnect()
        Disconnects and FtpChannel.
      • isConnected

        boolean isConnected()
        Returns:
        whether the FtpChannel is connected
      • cd

        void cd​(String path)
         throws IOException
        Changes the current remote directory.
        Parameters:
        path - target directory
        Throws:
        IOException - if the operation could not be performed remotely
      • rmdir

        void rmdir​(String path)
            throws IOException
        Deletes a directory on the remote file system. The directory must be empty.
        Parameters:
        path - to delete
        Throws:
        IOException
      • mkdir

        void mkdir​(String path)
            throws IOException
        Creates a directory on the remote file system.
        Parameters:
        path - to create
        Throws:
        IOException
      • rm

        void rm​(String path)
         throws IOException
        Deletes a file on the remote file system.
        Parameters:
        path - to delete
        Throws:
        IOException - if the file does not exist or could otherwise not be deleted
      • delete

        default void delete​(String path)
                     throws IOException
        Deletes a file on the remote file system. If the file does not exist, no exception is thrown.
        Parameters:
        path - to delete
        Throws:
        IOException - if the file exist but could not be deleted
      • rename

        void rename​(String from,
                    String to)
             throws IOException
        Renames a file on the remote file system. If to exists, it is replaced by from. (POSIX rename() semantics)
        Parameters:
        from - original name of the file
        to - new name of the file
        Throws:
        IOException
        See Also:
        stdio.h: rename()