Class SftpSession
java.lang.Object
org.springframework.integration.sftp.session.SftpSession
- All Implemented Interfaces:
Closeable,AutoCloseable,org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
public class SftpSession
extends Object
implements org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
Default SFTP
Session implementation. Wraps a MINA SSHD session instance.- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionSftpSession(org.apache.sshd.sftp.client.SftpClient sftpClient) SftpSession(org.apache.sshd.sftp.client.SftpClient sftpClient, boolean isSharedClient) Construct an instance based on aSftpClientand itssharedstatus. -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(InputStream inputStream, String destination) voidclose()Stream<org.apache.sshd.sftp.client.SftpClient.DirEntry> booleanbooleanorg.apache.sshd.sftp.client.SftpClientbooleanisOpen()org.apache.sshd.sftp.client.SftpClient.DirEntry[]String[]booleanvoidread(String source, OutputStream os) booleanvoidbooleanbooleantest()voidwrite(InputStream inputStream, String destination) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.file.remote.session.Session
dirty
-
Constructor Details
-
SftpSession
public SftpSession(org.apache.sshd.sftp.client.SftpClient sftpClient) -
SftpSession
public SftpSession(org.apache.sshd.sftp.client.SftpClient sftpClient, boolean isSharedClient) Construct an instance based on aSftpClientand itssharedstatus. WhenisSharedClient == true, theclose()is void.- Parameters:
sftpClient- theSftpClientto use.isSharedClient- whether theSftpClientis shared.- Since:
- 6.3.9
-
-
Method Details
-
remove
- Specified by:
removein interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
list
public org.apache.sshd.sftp.client.SftpClient.DirEntry[] list(@Nullable String path) throws IOException - Specified by:
listin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
listNames
- Specified by:
listNamesin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
doList
public Stream<org.apache.sshd.sftp.client.SftpClient.DirEntry> doList(@Nullable String path) throws IOException - Throws:
IOException
-
read
- Specified by:
readin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
readRaw
- Specified by:
readRawin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
finalizeRaw
public boolean finalizeRaw()- Specified by:
finalizeRawin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-
write
- Specified by:
writein interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
append
- Specified by:
appendin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-
rename
- Specified by:
renamein interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
mkdir
- Specified by:
mkdirin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
rmdir
- Specified by:
rmdirin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>- Throws:
IOException
-
exists
- Specified by:
existsin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-
getClientInstance
public org.apache.sshd.sftp.client.SftpClient getClientInstance()- Specified by:
getClientInstancein interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-
getHostPort
- Specified by:
getHostPortin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-
test
public boolean test()- Specified by:
testin interfaceorg.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
-