com.sshtools.sftp
Class Perl5RegExpMatching

java.lang.Object
  extended bycom.sshtools.sftp.Perl5RegExpMatching
All Implemented Interfaces:
RegularExpressionMatching

public class Perl5RegExpMatching
extends java.lang.Object
implements RegularExpressionMatching

Implements the RegularExpressionMatching Interface.

matchFileNamesWithPattern performs a perl regular expression pattern match on the Files passed to it, using fileNameRegExp, then returns the ones that match.

Code example:

 File f=new File("c:\\homefolder");
 File[] someFiles;
 List files in folder f and store in someFiles.
 someFiles=f.listFiles();
 Find the '.doc' files in someFiles that have 'rfc' in their name.
 String[] matchedFiles=matchFileNamesWithPattern(someFiles, "*rfc*.doc");
 

matchFilesWithPattern performs a perl regular expression pattern match on the SftpFiles passed to it, using fileNameRegExp, then returns the ones that match.


Constructor Summary
Perl5RegExpMatching()
           
 
Method Summary
 java.lang.String[] matchFileNamesWithPattern(java.io.File[] files, java.lang.String fileNameRegExp)
          compiles fileNameRegExp into a regular expression and pattern matches on each file's name, and returns those that match.
 SftpFile[] matchFilesWithPattern(SftpFile[] files, java.lang.String fileNameRegExp)
          compiles fileNameRegExp into a regular expression and pattern matches on each file's name, and returns those that match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Perl5RegExpMatching

public Perl5RegExpMatching()
Method Detail

matchFileNamesWithPattern

public java.lang.String[] matchFileNamesWithPattern(java.io.File[] files,
                                                    java.lang.String fileNameRegExp)
                                             throws SshException
compiles fileNameRegExp into a regular expression and pattern matches on each file's name, and returns those that match.

Specified by:
matchFileNamesWithPattern in interface RegularExpressionMatching
Parameters:
files -
fileNameRegExp -
Returns:
String[] of file names that match the expresion.
Throws:
SshException

matchFilesWithPattern

public SftpFile[] matchFilesWithPattern(SftpFile[] files,
                                        java.lang.String fileNameRegExp)
                                 throws SftpStatusException,
                                        SshException
compiles fileNameRegExp into a regular expression and pattern matches on each file's name, and returns those that match.

Specified by:
matchFilesWithPattern in interface RegularExpressionMatching
Parameters:
files -
fileNameRegExp -
Returns:
SftpFile[] of files that match the expresion.
Throws:
SftpStatusException
SshException


Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.