Class SFTPFileSystem

All Implemented Interfaces:
Closeable, AutoCloseable, AbstractFileSystem<SFTPFile>

public class SFTPFileSystem extends CommonAbstractFileSystem<SFTPFile>
  • Constructor Details

    • SFTPFileSystem

      public SFTPFileSystem(InetAddress host, int port, String username, String basePath)
    • SFTPFileSystem

      public SFTPFileSystem(InetAddress host, int port, String username, String basePath, boolean absoluteBasePath)
  • Method Details

    • isReusable

      public boolean isReusable()
      Description copied from interface: AbstractFileSystem
      If disconnected, can we re-connect after ?
    • isAvaliable

      public boolean isAvaliable()
    • getIOBufferSize

      public int getIOBufferSize()
      Description copied from interface: AbstractFileSystem
      65535 bytes
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setPasswordAuth

      public void setPasswordAuth(char[] password)
    • manuallyAddPrivatekeyAuth

      public void manuallyAddPrivatekeyAuth(File privateKey, char[] keyPassword)
      Parameters:
      privateKey - can be a file, or a directory of key files (like "~/.ssh/")
    • manuallyAddPrivatekeyAuth

      public void manuallyAddPrivatekeyAuth(File privateKey)
      Parameters:
      privateKey - can be a file, or a directory of key files (like "~/.ssh/")
    • getClient

      public net.schmizz.sshj.SSHClient getClient()
    • getSFTPClient

      public net.schmizz.sshj.sftp.SFTPClient getSFTPClient()
    • setTimeout

      public void setTimeout(long duration, TimeUnit unit)
      Description copied from interface: AbstractFileSystem
      Set socket/connection timeout.
      Specified by:
      setTimeout in interface AbstractFileSystem<SFTPFile>
      Overrides:
      setTimeout in class CommonAbstractFileSystem<SFTPFile>
    • connect

      public void connect()
    • isStatefulSFTPClient

      public boolean isStatefulSFTPClient()
    • setStatefulSFTPClient

      public void setStatefulSFTPClient(boolean statefulSFTPClient)
    • createANewSFTPClient

      public void createANewSFTPClient()
      Needed for simultaneous transferts: a = getFromPath() + createANewSFTPClient() + b = getFromPath() > a and b can do actions in same time.
    • close

      public void close()
    • getFromPath

      public SFTPFile getFromPath(String path)
      Parameters:
      path - relative path only
    • isAbsoluteBasePath

      public boolean isAbsoluteBasePath()
    • getHost

      public InetAddress getHost()
    • getUsername

      public String getUsername()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CommonAbstractFileSystem<SFTPFile>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class CommonAbstractFileSystem<SFTPFile>
    • reusableHashCode

      public int reusableHashCode()
      Returns:
      the same code for the same internal engine instance in FileSystem. Can be used for interract two FS and protect the both are not the same.