public class SftpFileSystem extends FileSystem
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
SftpFileSystem(String hostName,
int port,
String userName,
String password)
Connects to the specified SFTP server.
|
SftpFileSystem(String userName,
String password)
Connects to the specified SFTP server at localhost, default port 22.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection from an SFTP server.
|
List<SftpClient.DirEntry> |
listFolder(String folderName)
Returns the contents of the folder.
|
List<SftpClient.DirEntry> |
listRootFolder()
Returns the contents of the root folder.
|
void |
open()
Opens a connection to an SFTP server.
|
InputStream |
readFile(String fileName)
Reads the specified file in the root folder.
|
InputStream |
readFile(String folderName,
String fileName)
Reads a file in the specified folder.
|
OutputStream |
writeFile(String fileName)
Writes a file to the root folder.
|
OutputStream |
writeFile(String folderName,
String fileName)
Writes a file to the specified folder.
|
addElapsedtime, addExceptionProperties, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getNestedEndpoint, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getRootEndpoint, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription, toStringpublic SftpFileSystem(String userName, String password)
userName - name of the userpassword - password of the userpublic void open()
throws DataException
open in class EndpointDataExceptionpublic void close()
throws DataException
close in class EndpointDataExceptionpublic InputStream readFile(String folderName, String fileName) throws Throwable
InputStream or nullThrowablepublic InputStream readFile(String fileName) throws Throwable
InputStream or nullThrowablepublic List<SftpClient.DirEntry> listFolder(String folderName) throws Throwable
Throwablepublic List<SftpClient.DirEntry> listRootFolder() throws Throwable
Throwablepublic OutputStream writeFile(String fileName) throws Throwable
fileName - the name of the fileThrowablepublic OutputStream writeFile(String folderName, String fileName) throws Throwable
folderName - the folder namefileName - the name of the fileThrowableCopyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.