public class RobotRules extends Object
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
ALLOW_PATTERN |
protected static Pattern |
DISALLOW_PATTERN |
static String |
GLOBAL_USER_AGENT
Special name for User-agent which matches all values
|
protected static Pattern |
USER_AGENT_PATTERN |
Constructor and Description |
---|
RobotRules() |
Modifier and Type | Method and Description |
---|---|
boolean |
blocksPathForUA(String path,
String ua)
Checks first the specified ua UserAgent, if rules are present for it,
and then falls back to using rules for the '*' UserAgent.
|
List<String> |
getUserAgentsFound() |
boolean |
hasSyntaxErrors() |
void |
parse(InputStream is)
Read rules from InputStream argument into this RobotRules, as a
side-effect, sets the bSyntaxErrors property.
|
public static final String GLOBAL_USER_AGENT
protected static final Pattern USER_AGENT_PATTERN
protected static final Pattern DISALLOW_PATTERN
protected static final Pattern ALLOW_PATTERN
public boolean hasSyntaxErrors()
public List<String> getUserAgentsFound()
public void parse(InputStream is) throws IOException
is
- InputStream containing the robots.txt documentIOException
- for usual reasonspublic boolean blocksPathForUA(String path, String ua)
path
- String server relative path to check for accessua
- String user agent to check for accessCopyright © 2005–2015 IIPC. All rights reserved.