Class SftpClient
- java.lang.Object
-
- com.openindex.openestate.tool.utils.SftpClient
-
public class SftpClient extends Object
SftpClient.- Author:
- Andreas Rudolph
-
-
Constructor Summary
Constructors Constructor Description SftpClient(com.jcraft.jsch.Session session)SftpClient(String host, int port, String user, com.jcraft.jsch.UserInfo userInfo)SftpClient(String host, int port, String user, String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcd(String path)voidcdUp()voidchgrp(int gid, String path)voidchmod(int permissions, String path)voidchmod(String permissions, String path)voidchown(int uid, String path)voidconnect()voiddisconnect()voidexit()voidget(String src, OutputStream dst)voidget(String src, OutputStream dst, com.jcraft.jsch.SftpProgressMonitor monitor)voidget(String src, String dst)voidget(String src, String dst, com.jcraft.jsch.SftpProgressMonitor monitor)StringgetHome()voidhardlink(String oldpath, String newpath)booleanisConnected()List<com.jcraft.jsch.ChannelSftp.LsEntry>ls()List<com.jcraft.jsch.ChannelSftp.LsEntry>ls(String path)voidmkdir(String path)voidput(InputStream src, String dst)voidput(InputStream src, String dst, com.jcraft.jsch.SftpProgressMonitor monitor)voidput(String src, String dst)voidput(String src, String dst, com.jcraft.jsch.SftpProgressMonitor monitor)Stringpwd()voidrename(String oldpath, String newpath)voidrm(String path)voidrmdir(String path)voidrmdir(String path, boolean recursive)voidsetModificationTime(String path, int time)com.jcraft.jsch.SftpATTRSstat(String path)voidsymlink(String oldpath, String newpath)
-
-
-
Constructor Detail
-
SftpClient
public SftpClient(String host, int port, String user, String password) throws IOException
- Throws:
IOException
-
SftpClient
public SftpClient(String host, int port, String user, com.jcraft.jsch.UserInfo userInfo) throws IOException
- Throws:
IOException
-
SftpClient
public SftpClient(com.jcraft.jsch.Session session) throws IOException- Throws:
IOException
-
-
Method Detail
-
cd
public void cd(String path) throws IOException
- Throws:
IOException
-
cdUp
public void cdUp() throws IOException- Throws:
IOException
-
chgrp
public void chgrp(int gid, String path) throws IOException- Throws:
IOException
-
chmod
public void chmod(int permissions, String path) throws IOException- Throws:
IOException
-
chmod
public void chmod(String permissions, String path) throws IOException
- Throws:
IOException
-
chown
public void chown(int uid, String path) throws IOException- Throws:
IOException
-
connect
public void connect() throws IOException, SshUtils.AuthenticationFailedException, SshUtils.ConnectionFailedException
-
disconnect
public void disconnect()
-
exit
public void exit()
-
get
public void get(String src, String dst) throws IOException
- Throws:
IOException
-
get
public void get(String src, String dst, com.jcraft.jsch.SftpProgressMonitor monitor) throws IOException
- Throws:
IOException
-
get
public void get(String src, OutputStream dst) throws IOException
- Throws:
IOException
-
get
public void get(String src, OutputStream dst, com.jcraft.jsch.SftpProgressMonitor monitor) throws IOException
- Throws:
IOException
-
getHome
public String getHome() throws IOException
- Throws:
IOException
-
hardlink
public void hardlink(String oldpath, String newpath) throws IOException
- Throws:
IOException
-
isConnected
public boolean isConnected()
-
ls
public List<com.jcraft.jsch.ChannelSftp.LsEntry> ls() throws IOException
- Throws:
IOException
-
ls
public List<com.jcraft.jsch.ChannelSftp.LsEntry> ls(String path) throws IOException
- Throws:
IOException
-
mkdir
public void mkdir(String path) throws IOException
- Throws:
IOException
-
put
public void put(String src, String dst) throws IOException
- Throws:
IOException
-
put
public void put(String src, String dst, com.jcraft.jsch.SftpProgressMonitor monitor) throws IOException
- Throws:
IOException
-
put
public void put(InputStream src, String dst) throws IOException
- Throws:
IOException
-
put
public void put(InputStream src, String dst, com.jcraft.jsch.SftpProgressMonitor monitor) throws IOException
- Throws:
IOException
-
pwd
public String pwd() throws IOException
- Throws:
IOException
-
rename
public void rename(String oldpath, String newpath) throws IOException
- Throws:
IOException
-
rm
public void rm(String path) throws IOException
- Throws:
IOException
-
rmdir
public void rmdir(String path) throws IOException
- Throws:
IOException
-
rmdir
public void rmdir(String path, boolean recursive) throws IOException
- Throws:
IOException
-
setModificationTime
public void setModificationTime(String path, int time) throws IOException
- Throws:
IOException
-
stat
public com.jcraft.jsch.SftpATTRS stat(String path) throws IOException
- Throws:
IOException
-
symlink
public void symlink(String oldpath, String newpath) throws IOException
- Throws:
IOException
-
-