本文整理汇总了Java中com.trilead.ssh2.SFTPv3FileAttributes类的典型用法代码示例。如果您正苦于以下问题:Java SFTPv3FileAttributes类的具体用法?Java SFTPv3FileAttributes怎么用?Java SFTPv3FileAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SFTPv3FileAttributes类属于com.trilead.ssh2包,在下文中一共展示了SFTPv3FileAttributes类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mkdirs
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Makes sure that the directory exists, by creating it if necessary.
*/
public void mkdirs(String path, int posixPermission) throws IOException {
SFTPv3FileAttributes atts = _stat(path);
if (atts!=null && atts.isDirectory())
return;
int idx = path.lastIndexOf('/');
if (idx>0)
mkdirs(path.substring(0,idx), posixPermission);
try {
mkdir(path, posixPermission);
} catch (IOException e) {
throw new IOException2("Failed to mkdir "+path,e);
}
}
示例2: sshFileExists
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Check existence of a file
*
* @param sftpClient
* @param filename
* @return true, if file exists
* @throws Exception
*/
public boolean sshFileExists(SFTPv3Client sftpClient, String filename) {
try {
SFTPv3FileAttributes attributes = sftpClient.stat(filename);
if (attributes != null) {
return (attributes.isRegularFile());
} else {
return false;
}
} catch (Exception e) {
return false;
}
}
示例3: sshFileExists
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Check existence of a file
*
* @param sftpClient
* @param filename
* @return true, if file exists
* @throws Exception
*/
public boolean sshFileExists(SFTPv3Client sftpClient, String filename) {
try {
SFTPv3FileAttributes attributes = sftpClient.stat(filename);
if (attributes != null) {
return (attributes.isRegularFile());
} else {
return false;
}
} catch (Exception e) {
return false;
}
}
示例4: sshDirectoryExists
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Checks if a directory exists
*
* @param sftpClient
* @param directory
* @return true, if directory exists
*/
public boolean sshDirectoryExists(SFTPv3Client sftpClient, String directory) {
try {
SFTPv3FileAttributes attributes = sftpClient.stat(directory);
if (attributes != null) {
return (attributes.isDirectory());
} else {
return false;
}
} catch (Exception e) {
return false;
}
}
示例5: sshFileExists
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Check existence of a file
*
* @param sftpClient
* @param filename
* @return true, if file exists
* @throws Exception
*/
public boolean sshFileExists( SFTPv3Client sftpClient, String filename ) {
try {
SFTPv3FileAttributes attributes = sftpClient.stat( filename );
if ( attributes != null ) {
return ( attributes.isRegularFile() );
} else {
return false;
}
} catch ( Exception e ) {
return false;
}
}
示例6: _stat
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Graceful {@link #stat(String)} that returns null if the path doesn't exist.
*/
public SFTPv3FileAttributes _stat(String path) throws IOException {
try {
return stat(path);
} catch (SFTPException e) {
int c = e.getServerErrorCode();
if (c==ErrorCodes.SSH_FX_NO_SUCH_FILE || c==ErrorCodes.SSH_FX_NO_SUCH_PATH)
return null;
else
throw e;
}
}
示例7: sshDirectoryExists
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
/**
* Checks if a directory exists
*
* @param sftpClient
* @param directory
* @return true, if directory exists
*/
public boolean sshDirectoryExists( SFTPv3Client sftpClient, String directory ) {
try {
SFTPv3FileAttributes attributes = sftpClient.stat( directory );
if ( attributes != null ) {
return ( attributes.isDirectory() );
} else {
return false;
}
} catch ( Exception e ) {
return false;
}
}
示例8: chmod
import com.trilead.ssh2.SFTPv3FileAttributes; //导入依赖的package包/类
public void chmod(String path, int permissions) throws IOException {
SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
atts.permissions = permissions;
setstat(path, atts);
}