Class SFTPClient


  • public class SFTPClient
    extends SFTPv3Client
    This Class adds file manage capabilities to the SFTPv3Client class.
    Author:
    Kohsuke Kawaguchi
    • Method Detail

      • exists

        public boolean exists​(String path)
                       throws IOException
        Checks if the given path exists.
        Overrides:
        exists in class SFTPv3Client
        Parameters:
        path - directory or file path.
        Returns:
        true if it exists.
        Throws:
        IOException - if it is not possible to access to the directory or file .
      • mkdirs

        public void mkdirs​(String path,
                           int posixPermission)
                    throws IOException
        Makes sure that the directory exists, by creating it if necessary.
        Overrides:
        mkdirs in class SFTPv3Client
        Parameters:
        path - directory path.
        posixPermission - POSIX permissions.
        Throws:
        IOException - if it is not possible to access to the directory.
      • writeToFile

        public OutputStream writeToFile​(String path)
                                 throws IOException
        Description copied from class: SFTPv3Client
        Creates a new file and writes to it.
        Overrides:
        writeToFile in class SFTPv3Client
        Parameters:
        path - file path.
        Returns:
        Creates a new file and return an OutputStream to writes to it.
        Throws:
        IOException - if it is not possible to access to the file.
      • chmod

        public void chmod​(String path,
                          int permissions)
                   throws IOException
        Change file or directory permissions.
        Overrides:
        chmod in class SFTPv3Client
        Parameters:
        path - file or directory path.
        permissions - POSIX permissions.
        Throws:
        IOException - in case of error.