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 Details

    • SftpSession

      public SftpSession(org.apache.sshd.sftp.client.SftpClient sftpClient)
  • Method Details

    • remove

      public boolean remove(String path) throws IOException
      Specified by:
      remove in interface org.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(String path) throws IOException
      Specified by:
      list in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • listNames

      public String[] listNames(String path) throws IOException
      Specified by:
      listNames in interface org.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(String path) throws IOException
      Throws:
      IOException
    • read

      public void read(String source, OutputStream os) throws IOException
      Specified by:
      read in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • readRaw

      public InputStream readRaw(String source) throws IOException
      Specified by:
      readRaw in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • finalizeRaw

      public boolean finalizeRaw()
      Specified by:
      finalizeRaw in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • write

      public void write(InputStream inputStream, String destination) throws IOException
      Specified by:
      write in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • append

      public void append(InputStream inputStream, String destination) throws IOException
      Specified by:
      append in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • rename

      public void rename(String pathFrom, String pathTo) throws IOException
      Specified by:
      rename in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • mkdir

      public boolean mkdir(String remoteDirectory) throws IOException
      Specified by:
      mkdir in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • rmdir

      public boolean rmdir(String remoteDirectory) throws IOException
      Specified by:
      rmdir in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
      Throws:
      IOException
    • exists

      public boolean exists(String path)
      Specified by:
      exists in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • getClientInstance

      public org.apache.sshd.sftp.client.SftpClient getClientInstance()
      Specified by:
      getClientInstance in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • getHostPort

      public String getHostPort()
      Specified by:
      getHostPort in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • test

      public boolean test()
      Specified by:
      test in interface org.springframework.integration.file.remote.session.Session<org.apache.sshd.sftp.client.SftpClient.DirEntry>