Class GrepDelegator
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
-
- com.perforce.p4java.impl.mapbased.server.cmd.GrepDelegator
-
- All Implemented Interfaces:
IGrepDelegator
public class GrepDelegator extends BaseDelegator implements IGrepDelegator
Implementation of 'p4 grep'.
-
-
Field Summary
-
Fields inherited from class com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
MAX_LIMIT_SUPPORTED_MIN_VERSION, QUERY_EXPRESSIONS_SUPPORTED_MIN_VERSION, USER_RESTRICTIONS_SUPPORTED_MIN_VERSION
-
-
Constructor Summary
Constructors Constructor Description GrepDelegator(IOptionsServer server)
Instantiates a new grep delegator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<IFileLineMatch>
getMatchingLines(java.util.List<IFileSpec> fileSpecs, java.lang.String pattern, MatchingLinesOptions options)
Get list of matching lines in the specified file specs.java.util.List<IFileLineMatch>
getMatchingLines(java.util.List<IFileSpec> fileSpecs, java.lang.String pattern, java.util.List<java.lang.String> infoLines, MatchingLinesOptions options)
Get list of matching lines in the specified file specs.
-
-
-
Constructor Detail
-
GrepDelegator
public GrepDelegator(IOptionsServer server)
Instantiates a new grep delegator.- Parameters:
server
- the server
-
-
Method Detail
-
getMatchingLines
public java.util.List<IFileLineMatch> getMatchingLines(java.util.List<IFileSpec> fileSpecs, java.lang.String pattern, MatchingLinesOptions options) throws P4JavaException
Get list of matching lines in the specified file specs. This method implements the p4 grep command; for full semantics, see the separate p4 documentation and / or the GrepOptions Javadoc.- Specified by:
getMatchingLines
in interfaceIGrepDelegator
- Parameters:
fileSpecs
- file specs to search for matching linespattern
- non-null string pattern to be passed to the grep commandoptions
- - Options to grep command- Returns:
- - non-null but possibly empty list of file line matches
- Throws:
P4JavaException
- if any error occurs in the processing of this method.
-
getMatchingLines
public java.util.List<IFileLineMatch> getMatchingLines(@Nonnull java.util.List<IFileSpec> fileSpecs, @Nonnull java.lang.String pattern, @Nullable java.util.List<java.lang.String> infoLines, MatchingLinesOptions options) throws P4JavaException
Get list of matching lines in the specified file specs. This method implements the p4 grep command; for full semantics, see the separate p4 documentation and / or the GrepOptions Javadoc.This method allows the user to retrieve useful info and warning message lines the Perforce server may generate in response to things like encountering a too-long line, etc., by passing in a non-null infoLines parameter.
- Specified by:
getMatchingLines
in interfaceIGrepDelegator
- Parameters:
fileSpecs
- file specs to search for matching linespattern
- non-null string pattern to be passed to the grep commandinfoLines
- if not null, any "info" lines returned from the server (i.e. warnings about exceeded line lengths, etc.) will be put into the passed-in list in the order they are received.options
- - Options to grep command- Returns:
- - non-null but possibly empty list of file line matches
- Throws:
P4JavaException
- if any error occurs in the processing of this method.- Since:
- 2011.1
-
-