当前位置: 首页>>代码示例>>Java>>正文


Java SFTPv3Client.ls方法代码示例

本文整理汇总了Java中com.trilead.ssh2.SFTPv3Client.ls方法的典型用法代码示例。如果您正苦于以下问题:Java SFTPv3Client.ls方法的具体用法?Java SFTPv3Client.ls怎么用?Java SFTPv3Client.ls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.trilead.ssh2.SFTPv3Client的用法示例。


在下文中一共展示了SFTPv3Client.ls方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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 ( !Utils.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:pentaho,项目名称:pentaho-kettle,代码行数:51,代码来源:JobEntrySSH2GET.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:pentaho,项目名称:pentaho-kettle,代码行数:43,代码来源:JobEntrySSH2GET.java


注:本文中的com.trilead.ssh2.SFTPv3Client.ls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。