Class MinaSftpSession

java.lang.Object
org.pentaho.di.core.ssh.mina.MinaSftpSession
All Implemented Interfaces:
AutoCloseable, SftpSession

public class MinaSftpSession extends Object implements SftpSession
  • Constructor Details

    • MinaSftpSession

      public MinaSftpSession(org.apache.sshd.sftp.client.SftpClient client)
  • Method Details

    • list

      public List<SftpFile> list(String path) throws SftpException
      Description copied from interface: SftpSession
      Lists files and directories in the specified remote path.
      Specified by:
      list in interface SftpSession
      Parameters:
      path - the remote path to list
      Returns:
      list of files and directories
      Throws:
      SftpException - if the operation fails
    • exists

      public boolean exists(String path) throws SftpException
      Description copied from interface: SftpSession
      Checks if a remote path exists.
      Specified by:
      exists in interface SftpSession
      Parameters:
      path - the remote path to check
      Returns:
      true if the path exists, false otherwise
      Throws:
      SftpException - if the operation fails
    • isDirectory

      public boolean isDirectory(String path) throws SftpException
      Description copied from interface: SftpSession
      Checks if a remote path is a directory.
      Specified by:
      isDirectory in interface SftpSession
      Parameters:
      path - the remote path to check
      Returns:
      true if the path is a directory, false otherwise
      Throws:
      SftpException - if the operation fails
    • size

      public long size(String path) throws SftpException
      Description copied from interface: SftpSession
      Gets the size of a remote file.
      Specified by:
      size in interface SftpSession
      Parameters:
      path - the remote file path
      Returns:
      the file size in bytes
      Throws:
      SftpException - if the operation fails
    • download

      public void download(String remote, OutputStream target) throws SftpException
      Description copied from interface: SftpSession
      Downloads a remote file to the provided output stream.
      Specified by:
      download in interface SftpSession
      Parameters:
      remote - the remote file path
      target - the output stream to write to
      Throws:
      SftpException - if the download fails
    • upload

      public void upload(InputStream source, String remote, boolean overwrite) throws SftpException
      Description copied from interface: SftpSession
      Uploads data from an input stream to a remote file.
      Specified by:
      upload in interface SftpSession
      Parameters:
      source - the input stream to read from
      remote - the remote file path
      overwrite - whether to overwrite existing files
      Throws:
      SftpException - if the upload fails
    • mkdir

      public void mkdir(String path) throws SftpException
      Description copied from interface: SftpSession
      Creates a directory on the remote server.
      Specified by:
      mkdir in interface SftpSession
      Parameters:
      path - the remote directory path to create
      Throws:
      SftpException - if the operation fails
    • delete

      public void delete(String path) throws SftpException
      Description copied from interface: SftpSession
      Deletes a file or directory on the remote server.
      Specified by:
      delete in interface SftpSession
      Parameters:
      path - the remote path to delete
      Throws:
      SftpException - if the operation fails
    • rename

      public void rename(String oldPath, String newPath) throws SftpException
      Description copied from interface: SftpSession
      Renames or moves a file or directory on the remote server.
      Specified by:
      rename in interface SftpSession
      Parameters:
      oldPath - the current remote path
      newPath - the new remote path
      Throws:
      SftpException - if the operation fails
    • close

      public void close()
      Description copied from interface: SftpSession
      Closes the SFTP session and releases resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SftpSession