本文整理汇总了Java中com.trilead.ssh2.SFTPv3Client类的典型用法代码示例。如果您正苦于以下问题:Java SFTPv3Client类的具体用法?Java SFTPv3Client怎么用?Java SFTPv3Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SFTPv3Client类属于com.trilead.ssh2包,在下文中一共展示了SFTPv3Client类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sshFileExists
import com.trilead.ssh2.SFTPv3Client; //导入依赖的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;
}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:24,代码来源:JobEntrySSH2GET.java
示例2: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder(SFTPv3Client sftpClient, String foldername)
{
LogWriter log = LogWriter.getInstance();
boolean retval=false;
if(!sshDirectoryExists(sftpClient, foldername))
{
try
{
sftpClient.mkdir(foldername, 0700);
retval=true;
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobSSH2GET.Log.RemoteFolderCreated",foldername));
}catch (Exception e)
{
log.logError(toString(), Messages.getString("JobSSH2GET.Log.Error.CreatingRemoteFolder",foldername));
}
}
return retval;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:28,代码来源:JobEntrySSH2GET.java
示例3: sshFileExists
import com.trilead.ssh2.SFTPv3Client; //导入依赖的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;
}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:24,代码来源:JobEntrySSH2PUT.java
示例4: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder(SFTPv3Client sftpClient, String foldername)
{
LogWriter log = LogWriter.getInstance();
boolean retval=false;
if(!sshDirectoryExists(sftpClient, foldername))
{
try
{
sftpClient.mkdir(foldername, 0700);
retval=true;
}catch (Exception e)
{
log.logError(toString(), Messages.getString("JobSSH2PUT.Log.Error.CreatingRemoteFolder",foldername));
}
}
return retval;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:JobEntrySSH2PUT.java
示例5: copyRecursive
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* copy a directory from the remote host to the local one recursivly.
*
* @param sourceLocation the source directory on the remote host
* @param targetLocation the target directory on the local host
* @param sftpClient is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
* @return the number of files successfully copied
* @throws Exception
*/
private void copyRecursive(String sourceLocation, String targetLocation,
SFTPv3Client sftpClient,Pattern pattern,Job parentJob) throws Exception
{
String sourceFolder="."+FTPUtils.FILE_SEPARATOR;
if (sourceLocation!=null) sourceFolder=sourceLocation;
if (this.isDirectory(sftpClient, sourceFolder)) {
Vector<?> filelist = sftpClient.ls(sourceFolder);
Iterator<?> iterator = filelist.iterator();
while (iterator.hasNext()) {
SFTPv3DirectoryEntry dirEntry = (SFTPv3DirectoryEntry) iterator .next();
if (dirEntry == null) continue;
if (dirEntry.filename.equals(".") || dirEntry.filename.equals("..")) continue;
copyRecursive(sourceFolder + FTPUtils.FILE_SEPARATOR+dirEntry.filename, targetLocation + Const.FILE_SEPARATOR
+ dirEntry.filename, sftpClient,pattern,parentJob);
}
} else if (isFile(sftpClient, sourceFolder))
{
if(getFileWildcard(sourceFolder,pattern))
copyFile(sourceFolder, targetLocation, sftpClient);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:JobEntrySSH2GET.java
示例6: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder(SFTPv3Client sftpClient, String foldername)
{
boolean retval=false;
if(!sshDirectoryExists(sftpClient, foldername))
{
try
{
sftpClient.mkdir(foldername, 0700);
retval=true;
if(log.isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobSSH2GET.Log.RemoteFolderCreated",foldername));
}catch (Exception e)
{
logError(BaseMessages.getString(PKG, "JobSSH2GET.Log.Error.CreatingRemoteFolder",foldername));
}
}
return retval;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:27,代码来源:JobEntrySSH2GET.java
示例7: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder(SFTPv3Client sftpClient, String foldername)
{
boolean retval=false;
if(!sshDirectoryExists(sftpClient, foldername))
{
try
{
sftpClient.mkdir(foldername, 0700);
retval=true;
}catch (Exception e)
{
logError(BaseMessages.getString(PKG, "JobSSH2PUT.Log.Error.CreatingRemoteFolder",foldername));
}
}
return retval;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:26,代码来源:JobEntrySSH2PUT.java
示例8: sshDirectoryExists
import com.trilead.ssh2.SFTPv3Client; //导入依赖的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;
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:JobEntrySSH2GETDialog.java
示例9: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder(SFTPv3Client sftpClient, String foldername)
{
boolean retval=false;
if(!sshDirectoryExists(sftpClient, foldername))
{
try
{
sftpClient.mkdir(foldername, 0700);
retval=true;
if(log.isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobSSH2GET.Log.RemoteFolderCreated",foldername));
}catch (Exception e)
{
logError(BaseMessages.getString(PKG, "JobSSH2GET.Log.Error.CreatingRemoteFolder",foldername), e);
}
}
return retval;
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:27,代码来源:JobEntrySSH2GET.java
示例10: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder(SFTPv3Client sftpClient, String foldername)
{
boolean retval=false;
if(!sshDirectoryExists(sftpClient, foldername))
{
try
{
sftpClient.mkdir(foldername, 0700);
retval=true;
}catch (Exception e)
{
logError(BaseMessages.getString(PKG, "JobSSH2PUT.Log.Error.CreatingRemoteFolder",foldername), e);
}
}
return retval;
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:26,代码来源:JobEntrySSH2PUT.java
示例11: sshFileExists
import com.trilead.ssh2.SFTPv3Client; //导入依赖的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;
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:JobEntrySSH2GET.java
示例12: CreateRemoteFolder
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Create remote folder
*
* @param sftpClient
* @param foldername
* @return true, if foldername is created
*/
private boolean CreateRemoteFolder( SFTPv3Client sftpClient, String foldername ) {
boolean retval = false;
if ( !sshDirectoryExists( sftpClient, foldername ) ) {
try {
sftpClient.mkdir( foldername, 0700 );
retval = true;
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobSSH2GET.Log.RemoteFolderCreated", foldername ) );
}
} catch ( Exception e ) {
logError( BaseMessages.getString( PKG, "JobSSH2GET.Log.Error.CreatingRemoteFolder", foldername ), e );
}
}
return retval;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:JobEntrySSH2GET.java
示例13: isDirectory
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Checks if file is a directory
*
* @param sftpClient
* @param filename
* @return true, if filename is a directory
*/
public boolean isDirectory(SFTPv3Client sftpClient, String filename)
{
try {
return sftpClient.stat(filename).isDirectory();
}
catch(Exception e) {}
return false;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:16,代码来源:JobEntrySSH2GET.java
示例14: GetFiles
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* copy a directory from the remote host to the local one.
*
* @param sourceLocation the source directory on the remote host
* @param targetLocation the target directory on the local host
* @param sftpClient is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
* @return the number of files successfully copied
* @throws Exception
*/
@SuppressWarnings("unchecked")
private void GetFiles(String sourceLocation, String targetLocation,
SFTPv3Client sftpClient,Pattern pattern, Job parentJob) throws Exception
{
String sourceFolder=".";
if (!Const.isEmpty(sourceLocation))
sourceFolder=sourceLocation + FTPUtils.FILE_SEPARATOR;
else
sourceFolder+=FTPUtils.FILE_SEPARATOR;
Vector<SFTPv3DirectoryEntry> filelist = sftpClient.ls(sourceFolder);
if(filelist!=null)
{
Iterator<SFTPv3DirectoryEntry> iterator = filelist.iterator();
while (iterator.hasNext() && !parentJob.isStopped())
{
SFTPv3DirectoryEntry dirEntry = iterator.next();
if (dirEntry == null) continue;
if (dirEntry.filename.equals(".")
|| dirEntry.filename.equals("..") || isDirectory(sftpClient, sourceFolder+dirEntry.filename))
continue;
if(getFileWildcard(dirEntry.filename,pattern))
{
// Copy file from remote host
copyFile(sourceFolder + dirEntry.filename, targetLocation + FTPUtils.FILE_SEPARATOR + dirEntry.filename, sftpClient);
}
}
}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:46,代码来源:JobEntrySSH2GET.java
示例15: copyRecursive
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* copy a directory from the remote host to the local one recursivly.
*
* @param sourceLocation the source directory on the remote host
* @param targetLocation the target directory on the local host
* @param sftpClient is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
* @return the number of files successfully copied
* @throws Exception
*/
@SuppressWarnings("unchecked")
private void copyRecursive(String sourceLocation, String targetLocation,
SFTPv3Client sftpClient,Pattern pattern,Job parentJob) throws Exception
{
String sourceFolder="."+FTPUtils.FILE_SEPARATOR;
if (sourceLocation!=null) sourceFolder=sourceLocation;
if (this.isDirectory(sftpClient, sourceFolder)) {
Vector filelist = sftpClient.ls(sourceFolder);
Iterator iterator = filelist.iterator();
while (iterator.hasNext()) {
SFTPv3DirectoryEntry dirEntry = (SFTPv3DirectoryEntry) iterator .next();
if (dirEntry == null) continue;
if (dirEntry.filename.equals(".") || dirEntry.filename.equals("..")) continue;
copyRecursive(sourceFolder + FTPUtils.FILE_SEPARATOR+dirEntry.filename, targetLocation + Const.FILE_SEPARATOR
+ dirEntry.filename, sftpClient,pattern,parentJob);
}
} else if (isFile(sftpClient, sourceFolder))
{
if(getFileWildcard(sourceFolder,pattern))
copyFile(sourceFolder, targetLocation, sftpClient);
}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:36,代码来源:JobEntrySSH2GET.java
示例16: isFile
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Checks if file is a file
*
* @param sftpClient
* @param filename
* @return true, if filename is a directory
*/
public boolean isFile(SFTPv3Client sftpClient, String filename)
{
try
{
return sftpClient.stat(filename).isRegularFile();
}
catch(Exception e) {}
return false;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:17,代码来源:JobEntrySSH2GET.java
示例17: isDirectory
import com.trilead.ssh2.SFTPv3Client; //导入依赖的package包/类
/**
* Checks if file is a directory
*
* @param sftpClient
* @param filename
* @return true, if filename is a directory
*/
public boolean isDirectory(SFTPv3Client sftpClient, String filename)
{
try
{
return sftpClient.stat(filename).isDirectory();
}
catch(Exception e) {}
return false;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:17,代码来源:JobEntryFTPDelete.java
注:本文中的com.trilead.ssh2.SFTPv3Client类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论