Package me.saro.kit.ee.ftp
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 interfaceSftp.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 voidclose()closebooleandelete(java.lang.String filename)remove filecom.jcraft.jsch.ChannelSftpgetChannelSftp()com.jcraft.jsch.SessiongetSession()booleanhasDirectory(java.lang.String directoryName)has directory in pathbooleanhasFile(java.lang.String filename)has file in pathjava.util.List<java.lang.String>listDirectories()get directory list in now pathjava.util.List<java.lang.String>listDirectories(java.util.function.Predicate<java.lang.String> filter)get directory list in now pathjava.util.List<java.lang.String>listFiles()get file list in now pathjava.util.List<java.lang.String>listFiles(java.util.function.Predicate<java.lang.String> filter)get file list in now pathbooleanmkdir(java.lang.String createDirectoryName)make new directoryjava.lang.Stringpath()get now path
same method path(), pwd()booleanpath(java.lang.String pathname)move path
same method path(), cd()booleanrecv(java.lang.String remoteFilename, java.io.File localFile)recv filebooleansend(java.lang.String saveFilename, java.io.File localFile)send fileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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.IOExceptionDescription copied from interface:Ftpmove path
same method path(), cd() -
path
public java.lang.String path() throws java.io.IOExceptionDescription copied from interface:Ftpget now path
same method path(), pwd() -
listFiles
public java.util.List<java.lang.String> listFiles(java.util.function.Predicate<java.lang.String> filter) throws java.io.IOExceptionDescription copied from interface:Ftpget file list in now path -
listFiles
public java.util.List<java.lang.String> listFiles() throws java.io.IOExceptionDescription copied from interface:Ftpget file list in now path -
listDirectories
public java.util.List<java.lang.String> listDirectories(java.util.function.Predicate<java.lang.String> filter) throws java.io.IOExceptionDescription copied from interface:Ftpget directory list in now path- Specified by:
listDirectoriesin interfaceFtp- Parameters:
filter- file name filter- Returns:
- Throws:
java.io.IOException
-
listDirectories
public java.util.List<java.lang.String> listDirectories() throws java.io.IOExceptionDescription copied from interface:Ftpget directory list in now path- Specified by:
listDirectoriesin interfaceFtp- Returns:
- Throws:
java.io.IOException
-
hasFile
public boolean hasFile(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:Ftphas file in path -
hasDirectory
public boolean hasDirectory(java.lang.String directoryName) throws java.io.IOExceptionDescription copied from interface:Ftphas directory in path- Specified by:
hasDirectoryin interfaceFtp- Returns:
- Throws:
java.io.IOException
-
delete
public boolean delete(java.lang.String filename) throws java.io.IOExceptionDescription copied from interface:Ftpremove file -
send
public boolean send(java.lang.String saveFilename, java.io.File localFile) throws java.io.IOExceptionDescription copied from interface:Ftpsend file -
recv
public boolean recv(java.lang.String remoteFilename, java.io.File localFile) throws java.io.IOExceptionDescription copied from interface:Ftprecv file -
mkdir
public boolean mkdir(java.lang.String createDirectoryName) throws java.io.IOExceptionDescription copied from interface:Ftpmake new directory -
close
public void close()Description copied from interface:Ftpclose -
getChannelSftp
public com.jcraft.jsch.ChannelSftp getChannelSftp() -
getSession
public com.jcraft.jsch.Session getSession()
-