Package tv.hd3g.transfertfiles.sftp
Class SFTPFileSystem
- java.lang.Object
-
- tv.hd3g.transfertfiles.CommonAbstractFileSystem<SFTPFile>
-
- tv.hd3g.transfertfiles.sftp.SFTPFileSystem
-
- All Implemented Interfaces:
Closeable,AutoCloseable,AbstractFileSystem<SFTPFile>
public class SFTPFileSystem extends CommonAbstractFileSystem<SFTPFile>
-
-
Field Summary
-
Fields inherited from class tv.hd3g.transfertfiles.CommonAbstractFileSystem
timeoutDuration
-
-
Constructor Summary
Constructors Constructor Description SFTPFileSystem(InetAddress host, int port, String username, String basePath)SFTPFileSystem(InetAddress host, int port, String username, String basePath, boolean absoluteBasePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidconnect()voidcreateANewSFTPClient()Needed for simultaneous transferts: a = getFromPath() + createANewSFTPClient() + b = getFromPath() > a and b can do actions in same time.booleanequals(Object obj)net.schmizz.sshj.SSHClientgetClient()SFTPFilegetFromPath(String path)InetAddressgetHost()intgetIOBufferSize()65535 bytesnet.schmizz.sshj.sftp.SFTPClientgetSFTPClient()StringgetUsername()inthashCode()booleanisAbsoluteBasePath()booleanisAvaliable()booleanisReusable()If disconnected, can we re-connect after ?booleanisStatefulSFTPClient()voidmanuallyAddPrivatekeyAuth(File privateKey)voidmanuallyAddPrivatekeyAuth(File privateKey, char[] keyPassword)intreusableHashCode()voidsetPasswordAuth(char[] password)voidsetStatefulSFTPClient(boolean statefulSFTPClient)voidsetTimeout(long duration, TimeUnit unit)Set socket/connection timeout.StringtoString()-
Methods inherited from class tv.hd3g.transfertfiles.CommonAbstractFileSystem
getBasePath, getPathFromRelative, getTimeout
-
-
-
-
Constructor Detail
-
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 Detail
-
isReusable
public boolean isReusable()
Description copied from interface:AbstractFileSystemIf disconnected, can we re-connect after ?
-
isAvaliable
public boolean isAvaliable()
-
getIOBufferSize
public int getIOBufferSize()
Description copied from interface:AbstractFileSystem65535 bytes
-
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:AbstractFileSystemSet socket/connection timeout.- Specified by:
setTimeoutin interfaceAbstractFileSystem<SFTPFile>- Overrides:
setTimeoutin classCommonAbstractFileSystem<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()
-
isAbsoluteBasePath
public boolean isAbsoluteBasePath()
-
getHost
public InetAddress getHost()
-
getUsername
public String getUsername()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classCommonAbstractFileSystem<SFTPFile>
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classCommonAbstractFileSystem<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.
-
-