Class SftpSession
java.lang.Object
org.springframework.integration.sftp.session.SftpSession
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,org.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
public class SftpSession
extends java.lang.Object
implements org.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
Default SFTP
Session
implementation. Wraps a JSCH session instance.- Since:
- 2.0
-
Constructor Summary
Constructors Constructor Description SftpSession(com.jcraft.jsch.Session jschSession)
SftpSession(org.springframework.integration.sftp.session.JSchSessionWrapper wrapper)
-
Method Summary
Modifier and Type Method Description void
append(java.io.InputStream inputStream, java.lang.String destination)
void
close()
boolean
exists(java.lang.String path)
boolean
finalizeRaw()
com.jcraft.jsch.ChannelSftp
getClientInstance()
java.lang.String
getHostPort()
boolean
isOpen()
com.jcraft.jsch.ChannelSftp.LsEntry[]
list(java.lang.String path)
java.lang.String[]
listNames(java.lang.String path)
boolean
mkdir(java.lang.String remoteDirectory)
void
read(java.lang.String source, java.io.OutputStream os)
java.io.InputStream
readRaw(java.lang.String source)
boolean
remove(java.lang.String path)
void
rename(java.lang.String pathFrom, java.lang.String pathTo)
boolean
rmdir(java.lang.String remoteDirectory)
void
setChannelConnectTimeout(java.time.Duration timeout)
Set the connect timeout.boolean
test()
void
write(java.io.InputStream inputStream, java.lang.String destination)
-
Constructor Details
-
SftpSession
public SftpSession(com.jcraft.jsch.Session jschSession) -
SftpSession
public SftpSession(org.springframework.integration.sftp.session.JSchSessionWrapper wrapper)
-
-
Method Details
-
setChannelConnectTimeout
public void setChannelConnectTimeout(java.time.Duration timeout)Set the connect timeout.- Parameters:
timeout
- the timeout to set.- Since:
- 5.2
-
remove
public boolean remove(java.lang.String path) throws java.io.IOException- Specified by:
remove
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
list
public com.jcraft.jsch.ChannelSftp.LsEntry[] list(java.lang.String path) throws java.io.IOException- Specified by:
list
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
listNames
public java.lang.String[] listNames(java.lang.String path) throws java.io.IOException- Specified by:
listNames
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
read
public void read(java.lang.String source, java.io.OutputStream os) throws java.io.IOException- Specified by:
read
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
readRaw
public java.io.InputStream readRaw(java.lang.String source) throws java.io.IOException- Specified by:
readRaw
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
finalizeRaw
public boolean finalizeRaw()- Specified by:
finalizeRaw
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-
write
public void write(java.io.InputStream inputStream, java.lang.String destination) throws java.io.IOException- Specified by:
write
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
append
public void append(java.io.InputStream inputStream, java.lang.String destination) throws java.io.IOException- Specified by:
append
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
close
public void close()- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-
rename
public void rename(java.lang.String pathFrom, java.lang.String pathTo) throws java.io.IOException- Specified by:
rename
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
mkdir
public boolean mkdir(java.lang.String remoteDirectory) throws java.io.IOException- Specified by:
mkdir
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
rmdir
public boolean rmdir(java.lang.String remoteDirectory) throws java.io.IOException- Specified by:
rmdir
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
- Throws:
java.io.IOException
-
exists
public boolean exists(java.lang.String path)- Specified by:
exists
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-
getClientInstance
public com.jcraft.jsch.ChannelSftp getClientInstance()- Specified by:
getClientInstance
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-
getHostPort
public java.lang.String getHostPort()- Specified by:
getHostPort
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-
test
public boolean test()- Specified by:
test
in interfaceorg.springframework.integration.file.remote.session.Session<com.jcraft.jsch.ChannelSftp.LsEntry>
-