public class SftpFileSystem extends FileSystem
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, 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, toString
public SftpFileSystem(String userName, String password)
userName
- name of the userpassword
- password of the userpublic void open() throws DataException
open
in class Endpoint
DataException
public void close() throws DataException
close
in class Endpoint
DataException
public InputStream readFile(String folderName, String fileName) throws Throwable
InputStream
or null
Throwable
public InputStream readFile(String fileName) throws Throwable
InputStream
or null
Throwable
public List<SftpClient.DirEntry> listFolder(String folderName) throws Throwable
Throwable
public List<SftpClient.DirEntry> listRootFolder() throws Throwable
Throwable
public OutputStream writeFile(String fileName) throws Throwable
fileName
- the name of the fileThrowable
public OutputStream writeFile(String folderName, String fileName) throws Throwable
folderName
- the folder namefileName
- the name of the fileThrowable
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.