Package com.trilead.ssh2.jenkins
Class SFTPClient
java.lang.Object
com.trilead.ssh2.SFTPv3Client
com.trilead.ssh2.jenkins.SFTPClient
public class SFTPClient extends SFTPv3Client
This Class adds file manage capabilities to the SFTPv3Client class.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors Constructor Description SFTPClient(Connection conn) -
Method Summary
Modifier and Type Method Description SFTPv3FileAttributes_stat(String path)GracefulSFTPv3Client.stat(String)that returns null if the path doesn't exist.voidchmod(String path, int permissions)Change file or directory permissions.booleanexists(String path)Checks if the given path exists.voidmkdirs(String path, int posixPermission)Makes sure that the directory exists, by creating it if necessary.InputStreamread(String file)Read input stream.OutputStreamwriteToFile(String path)Creates a new file and writes to it.Methods inherited from class com.trilead.ssh2.SFTPv3Client
canonicalPath, close, closeFile, createFile, createFile, createFileTruncate, createFileTruncate, createSymlink, fsetstat, fstat, getCharset, getProtocolVersion, ls, lstat, mkdir, mv, openFileRO, openFileRW, read, readLink, rm, rmdir, setCharset, setstat, stat, write
-
Constructor Details
-
SFTPClient
- Throws:
IOException
-
-
Method Details
-
exists
Checks if the given path exists.- Overrides:
existsin classSFTPv3Client- Parameters:
path- directory or file path.- Returns:
- true if it exists.
- Throws:
IOException- if it is not possible to access to the directory or file .
-
_stat
GracefulSFTPv3Client.stat(String)that returns null if the path doesn't exist.- Overrides:
_statin classSFTPv3Client- Parameters:
path- directory path.- Returns:
- the sft pv 3 file attributes
- Throws:
IOException- if it is not possible to access to the directory.
-
mkdirs
Makes sure that the directory exists, by creating it if necessary.- Overrides:
mkdirsin classSFTPv3Client- Parameters:
path- directory path.posixPermission- POSIX permissions.- Throws:
IOException- if it is not possible to access to the directory.
-
writeToFile
Description copied from class:SFTPv3ClientCreates a new file and writes to it.- Overrides:
writeToFilein classSFTPv3Client- Parameters:
path- file path.- Returns:
- Creates a new file and return an OutputStream to writes to it.
- Throws:
IOException- if it is not possible to access to the file.
-
read
Description copied from class:SFTPv3ClientRead input stream.- Overrides:
readin classSFTPv3Client- Parameters:
file- file path.- Returns:
- return an InputStream to the file.
- Throws:
IOException- if it is not possible to access to the file.
-
chmod
Change file or directory permissions.- Overrides:
chmodin classSFTPv3Client- Parameters:
path- file or directory path.permissions- POSIX permissions.- Throws:
IOException- in case of error.
-