Class Sftp

java.lang.Object
me.saro.kit.ee.ftp.Sftp
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, Ftp

public class Sftp
extends java.lang.Object
implements Ftp
SFTP it is not FTPS SFTP != FTPS
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  Sftp.SftpOpener  
  • Constructor Summary

    Constructors
    Constructor Description
    Sftp​(java.lang.String host, int port, java.lang.String user, Sftp.SftpOpener opener)  
  • Method Summary

    Modifier and Type Method Description
    void close()
    close
    boolean delete​(java.lang.String filename)
    remove file
    com.jcraft.jsch.ChannelSftp getChannelSftp()  
    com.jcraft.jsch.Session getSession()  
    boolean hasDirectory​(java.lang.String directoryName)
    has directory in path
    boolean hasFile​(java.lang.String filename)
    has file in path
    java.util.List<java.lang.String> listDirectories()
    get directory list in now path
    java.util.List<java.lang.String> listDirectories​(java.util.function.Predicate<java.lang.String> filter)
    get directory list in now path
    java.util.List<java.lang.String> listFiles()
    get file list in now path
    java.util.List<java.lang.String> listFiles​(java.util.function.Predicate<java.lang.String> filter)
    get file list in now path
    boolean mkdir​(java.lang.String createDirectoryName)
    make new directory
    java.lang.String path()
    get now path
    same method path(), pwd()
    boolean path​(java.lang.String pathname)
    move path
    same method path(), cd()
    boolean recv​(java.lang.String remoteFilename, java.io.File localFile)
    recv file
    boolean send​(java.lang.String saveFilename, java.io.File localFile)
    send file

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface me.saro.kit.ee.ftp.Ftp

    cd, pwd, recv, send
  • Constructor Details

    • Sftp

      public Sftp​(java.lang.String host, int port, java.lang.String user, Sftp.SftpOpener opener) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • path

      public boolean path​(java.lang.String pathname) throws java.io.IOException
      Description copied from interface: Ftp
      move path
      same method path(), cd()
      Specified by:
      path in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • path

      public java.lang.String path() throws java.io.IOException
      Description copied from interface: Ftp
      get now path
      same method path(), pwd()
      Specified by:
      path in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • listFiles

      public java.util.List<java.lang.String> listFiles​(java.util.function.Predicate<java.lang.String> filter) throws java.io.IOException
      Description copied from interface: Ftp
      get file list in now path
      Specified by:
      listFiles in interface Ftp
      Parameters:
      filter - file name filter
      Returns:
      Throws:
      java.io.IOException
    • listFiles

      public java.util.List<java.lang.String> listFiles() throws java.io.IOException
      Description copied from interface: Ftp
      get file list in now path
      Specified by:
      listFiles in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • listDirectories

      public java.util.List<java.lang.String> listDirectories​(java.util.function.Predicate<java.lang.String> filter) throws java.io.IOException
      Description copied from interface: Ftp
      get directory list in now path
      Specified by:
      listDirectories in interface Ftp
      Parameters:
      filter - file name filter
      Returns:
      Throws:
      java.io.IOException
    • listDirectories

      public java.util.List<java.lang.String> listDirectories() throws java.io.IOException
      Description copied from interface: Ftp
      get directory list in now path
      Specified by:
      listDirectories in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • hasFile

      public boolean hasFile​(java.lang.String filename) throws java.io.IOException
      Description copied from interface: Ftp
      has file in path
      Specified by:
      hasFile in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • hasDirectory

      public boolean hasDirectory​(java.lang.String directoryName) throws java.io.IOException
      Description copied from interface: Ftp
      has directory in path
      Specified by:
      hasDirectory in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • delete

      public boolean delete​(java.lang.String filename) throws java.io.IOException
      Description copied from interface: Ftp
      remove file
      Specified by:
      delete in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • send

      public boolean send​(java.lang.String saveFilename, java.io.File localFile) throws java.io.IOException
      Description copied from interface: Ftp
      send file
      Specified by:
      send in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • recv

      public boolean recv​(java.lang.String remoteFilename, java.io.File localFile) throws java.io.IOException
      Description copied from interface: Ftp
      recv file
      Specified by:
      recv in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • mkdir

      public boolean mkdir​(java.lang.String createDirectoryName) throws java.io.IOException
      Description copied from interface: Ftp
      make new directory
      Specified by:
      mkdir in interface Ftp
      Returns:
      Throws:
      java.io.IOException
    • close

      public void close()
      Description copied from interface: Ftp
      close
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Specified by:
      close in interface Ftp
    • getChannelSftp

      public com.jcraft.jsch.ChannelSftp getChannelSftp()
    • getSession

      public com.jcraft.jsch.Session getSession()