public class GlobRegExpMatching extends Object implements RegularExpressionMatching
Implements the RegularExpressionMatching Interface.
matchFileNamesWithPattern performs a Glob 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 Glob regular expression pattern match on the SftpFiles passed to it, using fileNameRegExp, then returns the ones that match.
Constructor and Description |
---|
GlobRegExpMatching() |
Modifier and Type | Method and Description |
---|---|
String[] |
matchFileNamesWithPattern(File[] files,
String pattern)
compiles pattern into a regular expression and pattern
matches on each file's name, and returns those that match.
|
SftpFile[] |
matchFilesWithPattern(SftpFile[] files,
String pattern)
compiles pattern into a regular expression and pattern
matches on each file's name, and returns those that match.
|
public String[] matchFileNamesWithPattern(File[] files, String pattern) throws SshException
matchFileNamesWithPattern
in interface RegularExpressionMatching
files
- pattern
- SshException
public SftpFile[] matchFilesWithPattern(SftpFile[] files, String pattern) throws SftpStatusException, SshException
matchFilesWithPattern
in interface RegularExpressionMatching
files
- fileNameRegExp
- SftpStatusException
SshException
Copyright © 2024. All rights reserved.