Package org.pentaho.di.core.ssh
Interface SftpSession
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
MinaSftpSession
SFTP session interface providing secure file transfer operations.
All methods throw specific SFTP exceptions instead of generic IOException for better error handling.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the SFTP session and releases resources.voidDeletes a file or directory on the remote server.voiddownload(String remote, OutputStream target) Downloads a remote file to the provided output stream.booleanChecks if a remote path exists.booleanisDirectory(String path) Checks if a remote path is a directory.Lists files and directories in the specified remote path.voidCreates a directory on the remote server.voidRenames or moves a file or directory on the remote server.longGets the size of a remote file.voidupload(InputStream source, String remote, boolean overwrite) Uploads data from an input stream to a remote file.
-
Method Details
-
list
Lists files and directories in the specified remote path.- Parameters:
path- the remote path to list- Returns:
- list of files and directories
- Throws:
SftpException- if the operation fails
-
exists
Checks if a remote path exists.- Parameters:
path- the remote path to check- Returns:
- true if the path exists, false otherwise
- Throws:
SftpException- if the operation fails
-
isDirectory
Checks if a remote path is a directory.- Parameters:
path- the remote path to check- Returns:
- true if the path is a directory, false otherwise
- Throws:
SftpException- if the operation fails
-
size
Gets the size of a remote file.- Parameters:
path- the remote file path- Returns:
- the file size in bytes
- Throws:
SftpException- if the operation fails
-
download
Downloads a remote file to the provided output stream.- Parameters:
remote- the remote file pathtarget- the output stream to write to- Throws:
SftpException- if the download fails
-
upload
Uploads data from an input stream to a remote file.- Parameters:
source- the input stream to read fromremote- the remote file pathoverwrite- whether to overwrite existing files- Throws:
SftpException- if the upload fails
-
mkdir
Creates a directory on the remote server.- Parameters:
path- the remote directory path to create- Throws:
SftpException- if the operation fails
-
delete
Deletes a file or directory on the remote server.- Parameters:
path- the remote path to delete- Throws:
SftpException- if the operation fails
-
rename
Renames or moves a file or directory on the remote server.- Parameters:
oldPath- the current remote pathnewPath- the new remote path- Throws:
SftpException- if the operation fails
-
close
void close()Closes the SFTP session and releases resources.- Specified by:
closein interfaceAutoCloseable
-